Re: Bug of ALTER TABLE DROP CONSTRAINT

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Bug of ALTER TABLE DROP CONSTRAINT
Дата
Msg-id 603c8f070904020455k47229181h58a629ab9b7b3623@mail.gmail.com
обсуждение исходный текст
Ответ на Bug of ALTER TABLE DROP CONSTRAINT  ("Jacky Leng" <lengjianquan@163.com>)
Ответы Re: Bug of ALTER TABLE DROP CONSTRAINT  (Nikhil Sontakke <nikhil.sontakke@enterprisedb.com>)
Список pgsql-hackers
On Thu, Apr 2, 2009 at 3:25 AM, Jacky Leng <lengjianquan@163.com> wrote:
> Considering the following sequence:
>    create table t(a int primary key);
>    alter table t drop constraint t_pkey;
>    insert into t values(null);
>    ERROR:  null value in column "a" violates not-null constraint
>
> My question is, why "null" is not allowed to be inserted after primary key
> constraint has been dropped.

Making a column into the primary key forces the column to NOT NULL.
You'll need to DROP NOT NULL separately.

It's probably possible to beat on the code hard enough to fix this,
but I'm not really sure there's much point, since the situation is
rare and the workaround is easy.

...Robert


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [GENERAL] string_to_array with empty input
Следующее
От: Hiroshi Inoue
Дата:
Сообщение: Re: More message encoding woes