Re: ALTER TABLE Column NOT NULL?

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: ALTER TABLE Column NOT NULL?
Дата
Msg-id Pine.LNX.4.33L2.0201251706210.4396-100000@cm-lcon1-40-151.chello.cl
обсуждение исходный текст
Ответ на ALTER TABLE Column NOT NULL?  ("Gregory Wood" <gregw@com-stock.com>)
Ответы Re: ALTER TABLE Column NOT NULL?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
El Jan 25, Gregory Wood escribio:

> Is there any way to add a NOT NULL constraint to a new field in a table,
> *without* having to dump and restore the entire thing? I suppose I could add
> a trigger (or modify an existing one), but that feels so... wrong.

ALTER TABLE table-name ADD CONSTRAINT constraint-name CHECK (column
NOTNULL);

Note that there cannot be any NULL value in the column (BTW, this is a
good candidate for better error reporting)

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Siempre hay que alimentar a los dioses, aunque la tierra este seca" (Orual)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: ALTER TABLE Column NOT NULL?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: ALTER TABLE Column NOT NULL?