Re: Altering a table in Postgres to add a NOT NULL constraint

Поиск
Список
Период
Сортировка
От Ron Johnson
Тема Re: Altering a table in Postgres to add a NOT NULL constraint
Дата
Msg-id 1022459741.10220.328.camel@rebel
обсуждение исходный текст
Список pgsql-novice
Hi, Jason.

On Wed, 2002-05-22 at 20:54, Jason Cernansky wrote:
> The following statement should allow you to add a not null constraint to
> a table:
>
> ALTER TABLE tablename ADD CONSTRAINT notnullchk CHECK (columnname IS NOT
> NULL);

Thanks for showing me how to prevent NULLs.  Unfortunately,
that command is a column-level CHECK constraint, not a NOT
NULL constraint needed by ALTER TABLE ... PRIMARY KEY.

How do I know?  I tried it...

So, I now have to reload the table...

--
+---------------------------------------------------------+
| Ron Johnson, Jr.        Home: ron.l.johnson@cox.net     |
| Jefferson, LA  USA      http://ronandheather.dhs.org:81 |
|                                                         |
| "I have created a government of whirled peas..."        |
|   Maharishi Mahesh Yogi, 12-May-2002,                   |
!   CNN, Larry King Live                                  |
+---------------------------------------------------------+


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

Предыдущее
От: Ron Johnson
Дата:
Сообщение: Re: Copy Comand question
Следующее
От: "Adam Erickson"
Дата:
Сообщение: Possible use of a subselect?