Re: BUG #17845: insert into on conflict bug . - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #17845: insert into on conflict bug .
Date
Msg-id CAKFQuwZtoQ_Mmt2xuEe7pFvnbGYzPM7i1swpaTq8Ew7jHqVukA@mail.gmail.com
Whole thread Raw
In response to BUG #17845: insert into on conflict bug .  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #17845: insert into on conflict bug .
List pgsql-bugs
On Thursday, March 16, 2023, PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      17845
Logged by:          Zhou Digoal
Email address:      digoal@126.com
PostgreSQL version: 15.2
Operating system:   macos
Description:       

insert into on conflict bug .
In the following insert statement, the row has not been updated multiple
times, why is it still showing an error?

```
create table a (id int primary key, info text, ts date);


insert into a
select * from (values (1,'a',date '2022-01-01'),(1,'b',date
'2022-01-02'),(1,'c',date '2022-01-03')) as t (id,info,ts) order by ts
desc
on conflict (id)
do update set info=excluded.info, ts=excluded.ts where a.ts < excluded.ts ;


You have id=1 in there three times which is precisely the definition of “multiple times” (I.e., more than 1)

David J.

pgsql-bugs by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: pg_read_server_files doesn't let me use pg_ls_dir() or pg_read_file?
Next
From: Tom Lane
Date:
Subject: Re: BUG #17845: insert into on conflict bug .