Start a new topic

problem deleting NOT NULL constraint in postgreSQL

[This topic is migrated from our old forums. The original author name has been removed]

Hi, Just ran into this problem. In Alter Table --> Constraints --> Drop constraint, The generated SQL produces a syntax error about the name of the constraint . In the postgreSQL documentation, (http://www.postgresql.org/docs/8.1/static/ddl-alter.html) it says, bq. This works the same for all constraint types except not-null constraints. To drop a not null constraint use \\ ALTER TABLE products ALTER COLUMN product_no DROP NOT NULL; \\ (Recall that not-null constraints do not have names.) The correct alter table command worked fine.

[This reply is migrated from our old forums.]

Re: problem deleting NOT NULL constraint in postgreSQL
Tim, This is now fixed in the just released 7.0.6 version. Regards Roger
[This reply is migrated from our old forums. The original author name has been removed]

Re: problem deleting NOT NULL constraint in postgreSQL
Thanks for the reply. I went first to the constraints tab to look for the NOT NULL constraints, so I'm worried that others would have trouble finding where to remove these constraints. after you remove them, you might want to put a note there on the constraints tab to tell people where to go to delete NOT NULL constraints
[This reply is migrated from our old forums.]

Re: problem deleting NOT NULL constraint in postgreSQL
Hi Tim, Thanks for reporting this. The main problem seems to be that NOT NULL constrains show up in the Check Constraints tab, and if you remove it there, the invalid DROP CONSTRAINT statement is generated. If you instead uncheck the Nullable checkbox in the Columns tab, you get a valid DROP NOT NULL statement. We will fix this by ensuring that NOT NULL constraints do not show up in the Check Constraints tab. Best Regards, Hans