Re: ALTER TABLE & NOT NULL

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: ALTER TABLE & NOT NULL
Дата
Msg-id 3CAF4C7B.1050202@joeconway.com
обсуждение исходный текст
Ответ на ALTER TABLE & NOT NULL  ("Thomas T. Thai" <tom@minnesota.com>)
Ответы Re: ALTER TABLE & NOT NULL  ("Thomas T. Thai" <tom@minnesota.com>)
Список pgsql-general
Thomas T. Thai wrote:
> How do you alter a column so that it uses NOT NULL? I tried:
>
> alter table auth_users alter email set default not null;
>
> ERROR:  Column "email" is of type character varying but default expression
> is of type boolean
>         You will need to rewrite or cast the expression
>

I think you have to add a table constraint to do that. Something like:

ALTER TABLE auth_users ADD CONSTRAINT auth_users_email CHECK (email is
not null);

Joe



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

Предыдущее
От: "Thomas T. Thai"
Дата:
Сообщение: ALTER TABLE & NOT NULL
Следующее
От: "Thomas T. Thai"
Дата:
Сообщение: Re: ALTER TABLE & NOT NULL