On Fri, 2024-03-15 at 11:20 +0000, Dean Rasheed wrote: > To recap, this adds support for a single RETURNING list at the end of > a MERGE command, and a special MERGE_ACTION() function that may be > used in the RETURNING list to return the action command string > ('INSERT', 'UPDATE', or 'DELETE') that was executed.
... > So barring any further objections, I'd like to go ahead and get this > patch committed. All of my concerns have been extensively discussed and it seems like they are just the cost of having a good feature. Thank you for going through so many alternative approaches, I think the one you've arrived at is consistent with what Vik endorsed[1]. The MERGE_ACTION keyword is added to the 'col_name_keyword' and the 'bare_label_keyword' lists. That has some annoying effects, like: CREATE FUNCTION merge_action() RETURNS TEXT LANGUAGE SQL AS $$ SELECT 'asdf'; $$; ERROR: syntax error at or near "(" LINE 1: CREATE FUNCTION merge_action() RETURNS TEXT I didn't see any affirmative endorsement of exactly how the keyword is implemented, but that patch has been around for a while, and I didn't see any objection, either. I like this feature from a user perspective. So +1 from me. Regards, Jeff Davis [1] https://www.postgresql.org/message-id/7db39b45-821f-4894-ada9-c19570b11...@postgresfriends.org