| От | Tom Lane |
|---|---|
| Тема | Re: How to drop a NOT NULL column constraint? |
| Дата | |
| Msg-id | 12983.978458663@sss.pgh.pa.us обсуждение |
| Ответ на | How to drop a NOT NULL column constraint? (Ed Loehr <eloehr@austin.rr.com>) |
| Список | pgsql-general |
Ed Loehr <eloehr@austin.rr.com> writes:
> I need to alter the table to get rid of the "NOT NULL" constraint on the
> 'id' column. Can I do this using ALTER TABLE?
There isn't an ALTER TABLE variant for this at the moment, but you can
do it the hard way: reach in and change the attnotnull boolean in the
column's pg_attribute row. The actual update would only require
UPDATE pg_attribute SET attnotnull = 'f' WHERE
attname = 'id' AND attrelid = whatever...
but I don't believe this will be noticed automatically by running
backends. I think a VACUUM on your table afterwards would be sufficient
to force the backends to notice the change.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера