Re: Changing NOT NULL condition on column

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Changing NOT NULL condition on column
Дата
Msg-id 4588.1053489524@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Changing NOT NULL condition on column  (Bob Smith <bsmith@h-e.com>)
Список pgsql-admin
Bob Smith <bsmith@h-e.com> writes:
> I need to change the not-null restriction on some columns in a table,
> and this doesn't seem to be possible with ALTER TABLE.  Is it safe to
> connect as superuser and update pg_attribute.attnotnull directly?

Yeah.  I am not certain offhand that currently-running backends would
notice such a change, but at worst starting new sessions would cause
them to honor it.

> I'm currently running 7.2.3, but will be upgrading soon so I'd like to
> know if this would work with 7.3 as well.

In 7.3 there are ALTER TABLE variants to handle this more cleanly.

            regards, tom lane

В списке pgsql-admin по дате отправления:

Предыдущее
От: Bob Smith
Дата:
Сообщение: Changing NOT NULL condition on column
Следующее
От: "A.Bhuvaneswaran"
Дата:
Сообщение: Logfile removal