| От | Mario Weilguni |
|---|---|
| Тема | Re: Drop NOT NULL constraint !!! |
| Дата | |
| Msg-id | 200211210753.20466.mweilguni@sime.com обсуждение |
| Ответ на | Drop NOT NULL constraint !!! (Renê Salomão <rene@ibiz.com.br>) |
| Список | pgsql-general |
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
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера