Subject: Re: Allow ON CONFLICT DO UPDATE to return EXCLUDED values

From: Dean Rasheed <[email-masked]>
Date: Thu, 12 Feb 2026 12:23:17 +0000

On Thu, 12 Feb 2026 at 11:11, Dean Rasheed <[email-masked]> 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/[email-masked]

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

Regards,
Dean