PostgreSQL - change precision of numeric?

Andrius picture Andrius · Feb 12, 2014 · Viewed 39.3k times · Source

I tried to change precision like this:

ALTER Table account_invoice ALTER amount_total SET NUMERIC(5);

But I get syntax error, so I'm clearly doing something wrong. What is the right syntax to change precision of numeric in PostgreSQL?

Answer

huzeyfe picture huzeyfe · Feb 12, 2014

Try this:

ALTER Table account_invoice ALTER COLUMN amount_total TYPE DECIMAL(10,5);

DECIMAL(X, Y) -> X represents full length and Y represents precision of the number.