Reputation: 45952
How do I change column default value in PostgreSQL?
I've tried:
ALTER TABLE ONLY users ALTER COLUMN lang DEFAULT 'en_GB';
But it gave me an error:
ERROR: syntax error at or near "DEFAULT"
Upvotes: 221
Views: 191059
Reputation: 222849
If you want to remove the default value constraint, you can do:
ALTER TABLE <table> ALTER COLUMN <column> DROP DEFAULT;
Upvotes: 130
Reputation: 45952
'SET' is forgotten
ALTER TABLE ONLY users ALTER COLUMN lang SET DEFAULT 'en_GB';
Upvotes: 412