Weird error message from Postgres 18 - Mailing list pgsql-hackers

From Ranier Vilela
Subject Weird error message from Postgres 18
Date
Msg-id CAEudQApWA_+AOmcwn8vqwZcYEV2WJh0X-rvO4wQSOr_UVJXcKA@mail.gmail.com
Whole thread Raw
Responses Re: Weird error message from Postgres 18
List pgsql-hackers
Hi.

I noticed a weird message error from Postgres 18.

sql reproducible test:
create table inserttest (col1 serial PRIMARY KEY, col2 int4 NOT NULL, col3 text NOT NULL, col4 text NULL);
insert into inserttest select 0 AS col2, NULL AS col3, NULL AS col4;
ERROR:  null value in column "col2" of relation "inserttest" violates not-null constraint
DETAIL:  Failing row contains (0, null, null, null).
drop table inserttest;

It seems that the message is confusing.
col2 and col3 IS NOT NULL, but col2 has value 0.

best regards,
Ranier Vilela
Attachment

pgsql-hackers by date:

Previous
From: Kirill Reshke
Date:
Subject: Remove unneeded cast in heap_xlog_lock.
Next
From: Jingtang Zhang
Date:
Subject: Re: Memory leak of SMgrRelation object on standby