Is this a buggy behavior?

Поиск
Список
Период
Сортировка
От sud
Тема Is this a buggy behavior?
Дата
Msg-id CAD=mzVV6SKgj0-vO2+vx2x3qHXDw6ZCSCkm3EnAKpwkOPjUgrA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Is this a buggy behavior?
Список pgsql-general
Hello All,
Create a table and composite primary key. But to my surprise it allowed me to have the composite primary key created even if one of the columns was defined as nullable. But then inserting the NULL into that column erroring out at the first record itself , stating "not null constraint" is violated.

CREATE TABLE test1
(
c1 varchar(36)   NULL ,
c2 varchar(36)  NOT NULL ,
CONSTRAINT test1_PK PRIMARY KEY (c1,c2)
) ;

-- Table created without any error even one of the columns in the PK was defined as NULL.

insert into test1 values(null,'123');

ERROR:  null value in column "c1" of relation "test1" violates not-null constraint
DETAIL:  Failing row contains (null, 123).

insert into test1 values('123','123');

--works fine as expected 


Regards
Sud

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

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: Statistics information.
Следующее
От: Lok P
Дата:
Сообщение: Re: Not able to purge partition