From: | Mario Weilguni <mweilguni(at)sime(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Drop NOT NULL constraint !!! |
Date: | 2002-11-21 06:53:20 |
Message-ID: | 200211210753.20466.mweilguni@sime.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
Am Mittwoch, 20. November 2002 20:09 schrieb RenX SalomXo:
> Does anybody could tell me how to drop a constraint on a column where no
> name was provided to the constraint? How does Pg name constraints?
>
> Thanks
did you add a "CHECK" constraint, or did you use "NOT NULL" in the table definition? For the not null case it's easy:
update pg_attribute
set attnotnull=false
where attname='yourattributename'
and attrelid=(select oid from pg_class where relname='mytable' and relkind='r');
If you added a check constraint, you have to remove the corresponding row from pg_relcheck
and decrement the attribute "relchecks" in pg_class for the table, but I won't do it without having
a backup at hand.
Backup your data first.
Regards,
Mario Weilguni
From | Date | Subject | |
---|---|---|---|
Next Message | Jean-Christian Imbeault | 2002-11-21 07:01:12 | Re: bug: select date 'infinity' gives error |
Previous Message | Henrik Steffen | 2002-11-21 06:48:39 | what's that error? |
From | Date | Subject | |
---|---|---|---|
Next Message | ernest_it@hotmail.com | 2002-11-21 07:03:19 | can i decrease the query time? |
Previous Message | Rajesh Kumar Mallah. | 2002-11-21 06:47:09 | why the difference? |