postgresql/src/backend/rewrite
Dean Rasheed c649fa24a4 Add RETURNING support to MERGE.
This allows a RETURNING clause to be appended to a MERGE query, to
return values based on each row inserted, updated, or deleted. As with
plain INSERT, UPDATE, and DELETE commands, the returned values are
based on the new contents of the target table for INSERT and UPDATE
actions, and on its old contents for DELETE actions. Values from the
source relation may also be returned.

As with INSERT/UPDATE/DELETE, the output of MERGE ... RETURNING may be
used as the source relation for other operations such as WITH queries
and COPY commands.

Additionally, a special function merge_action() is provided, which
returns 'INSERT', 'UPDATE', or 'DELETE', depending on the action
executed for each row. The merge_action() function can be used
anywhere in the RETURNING list, including in arbitrary expressions and
subqueries, but it is an error to use it anywhere outside of a MERGE
query's RETURNING list.

Dean Rasheed, reviewed by Isaac Morland, Vik Fearing, Alvaro Herrera,
Gurjeet Singh, Jian He, Jeff Davis, Merlin Moncure, Peter Eisentraut,
and Wolfgang Walther.

Discussion: http://postgr.es/m/CAEZATCWePEGQR5LBn-vD6SfeLZafzEm2Qy_L_Oky2=qw2w3Pzg@mail.gmail.com
2024-03-17 13:58:59 +00:00
..
Makefile SEARCH and CYCLE clauses 2021-02-01 14:32:51 +01:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
rewriteDefine.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
rewriteHandler.c Add RETURNING support to MERGE. 2024-03-17 13:58:59 +00:00
rewriteManip.c Support MERGE into updatable views. 2024-02-29 15:56:59 +00:00
rewriteRemove.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
rewriteSearchCycle.c Make the order of the header file includes consistent 2024-03-13 15:07:00 +01:00
rewriteSupport.c Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
rowsecurity.c Add RETURNING support to MERGE. 2024-03-17 13:58:59 +00:00