Re: Drop NOT NULL constraint !!!

Поиск
Список
Период
Сортировка
От 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 по дате отправления:

Предыдущее
От: "Henrik Steffen"
Дата:
Сообщение: what's that error?
Следующее
От: Jean-Christian Imbeault
Дата:
Сообщение: Re: bug: select date 'infinity' gives error