I found how to add value to the TYPE
. But how can I remove value from it?
For example I have TYPE
with enum
values ('A','B','C')
. How to remove 'C'
?
You must own the type to use ALTER TYPE . To change the schema of a type, you must also have CREATE privilege on the new schema. To alter the owner, you must also be a direct or indirect member of the new owning role, and that role must have CREATE privilege on the type's schema.
First, specify the name of the table to which the column you want to change belongs in the ALTER TABLE clause. Second, give the name of column whose data type will be changed in the ALTER COLUMN clause. Third, provide the new data type for the column after the TYPE keyword.
First, specify the name of the table that you want to update data after the UPDATE keyword. Second, specify columns and their new values after SET keyword. The columns that do not appear in the SET clause retain their original values. Third, determine which rows to update in the condition of the WHERE clause.
To remove value ('val1') from enum ('enum_test') you can use:
DELETE FROM pg_enum WHERE enumlabel = 'val1' AND enumtypid = ( SELECT oid FROM pg_type WHERE typname = 'enum_test' )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With