Re: BUG #16706: insert into on conflict(pk) do update error violates not-null constraint - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #16706: insert into on conflict(pk) do update error violates not-null constraint
Date
Msg-id 1974489.1604935011@sss.pgh.pa.us
Whole thread Raw
In response to BUG #16706: insert into on conflict(pk) do update error violates not-null constraint  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #16706: insert into on conflict(pk) do update error violates not-null constraint
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> example:
> CREATE TABLE TEST1 (
>     id varchar(100) NOT NULL,
>     name varchar(100) NOT NULL,
>     status varchar(100) NOT NULL,
>     CONSTRAINT test1_pkey PRIMARY KEY (id)
> )

> insert into TEST1 (ID, NAME,STATUS ) values('4','test','6') ;
> insert into TEST1 as t1 (ID, NAME,STATUS ) values('4',null,'6') on conflict
> (id) do update set NAME=COALESCE(excluded.NAME,t1.NAME),
> STATUS=COALESCE(excluded.STATUS,t1.STATUS);

I get

ERROR:  null value in column "name" violates not-null constraint
DETAIL:  Failing row contains (4, null, 6).

so this seems to have been fixed already.

            regards, tom lane



pgsql-bugs by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Re: BUG #16702: inline code and function : when use dynamic name for rowtype, there is some bug!
Next
From: "David G. Johnston"
Date:
Subject: Re: Re: BUG #16702: inline code and function : when use dynamic name for rowtype, there is some bug!