Re: Error with Insert from View with ON Conflict - Mailing list pgsql-general

From Peter Geoghegan
Subject Re: Error with Insert from View with ON Conflict
Date
Msg-id CAH2-Wzm7=qhf3itAzmCGPyKOqW14aseiHtj7eNue6NXN8HyYnw@mail.gmail.com
Whole thread Raw
In response to Re: Error with Insert from View with ON Conflict  (Steve Baldwin <steve.baldwin@gmail.com>)
Responses Re: Error with Insert from View with ON Conflict  (Alex Magnum <magnum11200@gmail.com>)
List pgsql-general
On Wed, Nov 3, 2021 at 2:18 PM Steve Baldwin <steve.baldwin@gmail.com> wrote:
> I'm pretty sure the 'alias' for the '.. on conflict do update ..' needs to be 'excluded' (i.e. checks =
excluded.checks,...). Check the docs.
 

That's right . The excluded.* pseudo-table isn't exactly the same
thing as the target table -- it is a tuple that has the same "shape",
that represents what the implementation tried (and failed) to insert
into the table. I have to imagine that Alex wants to reference that,
because that's the standard idiomatic approach with ON CONFLICT. And
because the only alternative interpretation is that Alex intends to
update those columns using their current values (not new values),
which won't really change anything -- that seems unlikely to have been
the intent.

-- 
Peter Geoghegan



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: to_date() and to_timestamp() with negative years
Next
From: Bryn Llewellyn
Date:
Subject: Re: to_date() and to_timestamp() with negative years