Commits on Aug 21, 2026
-
Allow EXCLUDED in RETURNING list of INSERT ON CONFLICT DO SELECT/UPDATE.
This allows an INSERT ... ON CONFLICT DO SELECT/UPDATE command to return the excluded values, when conflicts occur. For rows that do not conflict, the excluded values returned are NULL. This builds on the infrastructure added to support OLD/NEW values in the RETURNING list, except that in the case of EXCLUDED, there is no need for the special syntax to change the name of the excluded pseudo-relation in the RETURNING list. (That was required for OLD/NEW, because those names were already used in some situations, such as trigger functions, but there is no such problem with excluded.) Discussion: https://postgr.es/m/CAEZATCXXu2ohYmn=4YrRQa9yNwD_fdEEOTBPgM_5jhQOFcaQ4g@mail.gmail.com