Re: Allow ON CONFLICT DO UPDATE to return EXCLUDED values

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allow ON CONFLICT DO UPDATE to return EXCLUDED values
Date: 2025-07-09 12:13:57
Message-ID: CAEZATCUVjmVAwJ8SXb7CP4k1gN9yWd7bDUrJVwOoCLbq6FiRPg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 7 Jul 2025 at 19:09, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> wrote:
>
> On 07.07.25 19:52, Dean Rasheed wrote:
> > perhaps that should say
> >
> > Note that any values that were supplied by defaults, as well as
> > the effects of all per-row BEFORE INSERT triggers are reflected
> > in excluded values, since that may have contributed to the row
> > being excluded from insertion.
>
> +1
>
> IMO a short mention at insert.sgml also wouldn't hurt, e.g.
>
> If the INSERT has an ON CONFLICT DO UPDATE clause, a column name or *
> may be qualified using EXCLUDED to return the values that would have
> been inserted. These values include any DEFAULT expressions or computed
> expressions from the INSERT clause. If there is no conflict, then all
> EXCLUDED values will be NULL.

Thanks. I like some of this text better than what I originally wrote.
However, I don't like repeating different fragments of information in
different places on the same page. I think it's better to have a
single place on that page that describes all the properties of the
special excluded table, and then refer to that. In the attached v3,
I've done that in the form of a <note>, which makes it stand out more,
and is easier to refer to.

Regards,
Dean

Attachment Content-Type Size
v3-0001-Allow-EXCLUDED-in-RETURNING-list-of-INSERT-ON-CON.patch text/x-patch 103.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2025-07-09 12:16:32 Re: A recent message added to pg_upgade
Previous Message Amit Kapila 2025-07-09 12:08:58 Re: Conflict detection for update_deleted in logical replication