2

I have a table in PostgreSQL where one column "vat" has type money but I would like to alter it to decimal instead.

How can I do it?

I tried with:

alter table my_table alter column vat type decimal;

But I get this error:

ERROR:  column "vat" cannot be cast to type numeric

Any suggestions?

4

Try providing USING clause as described in docs:

A USING clause must be provided if there is no implicit or assignment cast from old to new type.

  • Por ejemplo: alter table my_table alter column vat type decimal using vat::decimal; – Scott Marlowe Sep 26 '11 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.