Re: How to ALTER COLUMN to set a constraint of not null?

Поиск
Список
Период
Сортировка
От Peter Gibbs
Тема Re: How to ALTER COLUMN to set a constraint of not null?
Дата
Msg-id 024001c2bbb1$f653fca0$0b01010a@emkel.co.za
обсуждение исходный текст
Ответ на How to ALTER COLUMN to set a constraint of not null?  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Ответы Re: How to ALTER COLUMN to set a constraint of not null?  (Neil Conway <neilc@samurai.com>)
Список pgsql-general
Jean-Christian Imbeault wrote:

> How does one add a "NOT NULL" constraint to a new column?

> JC=# alter table credit_card_names alter column number_length set
> default not null;
> ERROR:  Column "number_length" is of type smallint but default

ALTER TABLE [ ONLY ] table [ * ]
    ALTER [ COLUMN ] column { SET | DROP } NOT NULL

i.e.  alter table credit_card_names alter column number_length set not null;

--
Peter Gibbs
EmKel Systems


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

Предыдущее
От: "Julian Scarfe"
Дата:
Сообщение: Vacuum verbose output?
Следующее
От: Jochem van Dieten
Дата:
Сообщение: Re: PostgreSQL on Windows