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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: zhongxuchen(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16706: insert into on conflict(pk) do update error violates not-null constraint
Date: 2020-11-09 15:16:51
Message-ID: 1974489.1604935011@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2020-11-09 16:07:15 Re: Re: BUG #16702: inline code and function : when use dynamic name for rowtype, there is some bug!
Previous Message Pavel Stehule 2020-11-09 14:15:35 Re: Re: BUG #16702: inline code and function : when use dynamic name for rowtype, there is some bug!