Re: Is this a buggy behavior?

Поиск
Список
Период
Сортировка
От Thiemo Kellner
Тема Re: Is this a buggy behavior?
Дата
Msg-id 30b43590-3a90-4806-aa94-22c9fbbf07ce@gelassene-pferde.biz
обсуждение исходный текст
Ответ на Re: Is this a buggy behavior?  (sud <suds1434@gmail.com>)
Список pgsql-general

Am 24.03.2024 um 16:35 schrieb sud:
> On Sun, Mar 24, 2024 at 8:47 PM Tom Lane <tgl@sss.pgh.pa.us 
> <mailto:tgl@sss.pgh.pa.us>> wrote:
> Do you specifically mean that 'null'  keyword is just not making any 
> sense here in postgres. But even if that is the case , i tried inserting 
> nothing (hoping "nothing" is "null" in true sense), but then too it 
> failed in the first statement while inserting which is fine as per the PK.

To the best of my knowledge, your assumption is correct. And therefore 
the insert must fail because a pk never must contain null values.

> But don't you think,in the first place it shouldn't have been allowed to 
> create the table with one of the composite PK columns being defined as 
> NULL. And then , while inserting the null record, it should say that the 
> PK constraint is violated but not the "not null constraint" violated.
> 
> CREATE TABLE test1
> (
> c1 numeric   NULL ,
> c2 varchar(36)  NOT NULL ,
> CONSTRAINT test1_PK PRIMARY KEY (c1,c2)
> ) ;
> 
> insert into test1(c2) values('123');
> 
> /*ERROR: null value in column "c1" of relation "test1" violates not-null 
> constraint DETAIL: Failing row contains (null, 123).*/

I feel largely the same way. The definition is contradictory but there 
is no message to tell you so.



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

Предыдущее
От: Thiemo Kellner
Дата:
Сообщение: Re: Is this a buggy behavior?
Следующее
От: Andreas Kretschmer
Дата:
Сообщение: Re: Is this a buggy behavior?