Re: BUG #17845: insert into on conflict bug .

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #17845: insert into on conflict bug .
Дата
Msg-id 3759407.1678972226@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #17845: insert into on conflict bug .  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Thursday, March 16, 2023, PG Bug reporting form <noreply@postgresql.org>
> wrote:
>> In the following insert statement, the row has not been updated multiple
>> times, why is it still showing an error?

>> 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)

Yeah.  I believe the reason for the restriction is that it would
otherwise be very uncertain what order the input rows get processed in.
(No, the "order by" won't save you, because there's still a join
to be done after that.)

            regards, tom lane



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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #17845: insert into on conflict bug .
Следующее
От: jian he
Дата:
Сообщение: Re: BUG #17845: insert into on conflict bug .