Search code examples
postgresqlenumsddl

How to modify add type enum table postgres?


Good day, I have a table orders and there is a column payment_status type enum but I mysql know how to edit the column but postgresql could not change.

ALTER TABLE orders ALTER COLUMN payment_status ALTER TYPE enum_type ADD VALUE 'review';

I have to add the review status. but it doesn't work.

ERROR:  syntax error at or near "ALTER"
LINE 1: alter table orders alter column payment_status ALTER TYPE st...

the error is this.

Thanks in advance


Solution

  • No need for ALTER TABLE. Use the ALTER TYPE command on its own:

    ALTER TYPE enum_type ADD VALUE 'review';