Re: Allow ON CONFLICT DO UPDATE to return EXCLUDED values - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: Allow ON CONFLICT DO UPDATE to return EXCLUDED values
Date
Msg-id CAEZATCUK2cK1dGPTDr9WwR1MJxkzHtUixbZCRaBTEsoZAcegEw@mail.gmail.com
Whole thread
In response to Re: Allow ON CONFLICT DO UPDATE to return EXCLUDED values  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Responses Re: Allow ON CONFLICT DO UPDATE to return EXCLUDED values
List pgsql-hackers
On Thu, 12 Feb 2026 at 11:11, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>
> Rebased version attached (now also works with ON CONFLICT DO SELECT).
>

Something else to consider is the fact that this patch allows both
colname and EXCLUDED.colname to appear in the RETURNING list, where
the former refers to the target relation as it always has done. We're
pretty-much forced into that position, in order that people don't have
to rewrite all their existing queries (the same was true when support
for OLD/NEW was added to RETURNING).

But that then leads to the odd situation where colname has to be
qualified when it appears on the RHS of a SET clause, or in the WHERE
clause of INSERT ON CONFLICT, but not when it appears in the RETURNING
list.

There was a separate discussion [1] about whether we should remove
this requirement for colname to be qualified elsewhere in INSERT ON
CONFLICT, and I think this patch adds more weight to that argument.

[1] https://www.postgresql.org/message-id/flat/a31a76b6-b176-47fe-8778-9dfece231341@wikimedia.org

So should we do that, and allow unqualified column names in ON
CONFLICT SET and WHERE?

Regards,
Dean



pgsql-hackers by date:

Previous
From: Florin Irion
Date:
Subject: psql tab completion for user functions and if explicitly required also "pg_"
Next
From: Jakub Wartak
Date:
Subject: Re: 64-bit wait_event and introduction of 32-bit wait_event_arg