Re: MERGE ... RETURNING - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: MERGE ... RETURNING
Date
Msg-id 5dde223210f37c68a81f8a91715e94526d99b443.camel@j-davis.com
Whole thread Raw
In response to MERGE ... RETURNING  (Dean Rasheed <dean.a.rasheed@gmail.com>)
List pgsql-hackers
On Sun, 2023-01-08 at 12:28 +0000, Dean Rasheed wrote:
> I considered allowing a separate RETURNING list at the end of each
> action, but rapidly dismissed that idea.

One potential benefit of that approach is that it would be more natural
to specify output specific to the action, e.g.

   WHEN MATCHED THEN UPDATE ... RETURNING 'UPDATE', ...

which would be an alternative to the special function pg_merge_action()
or "WITH WHEN".

I agree that it can be awkward to specify multiple RETURNING clauses
and get the columns to match up, but it's hard for me to say whether
it's better or worse without knowing more about the use cases.

Regards,
    Jeff Davis




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Potential memory leak in contrib/intarray's g_intbig_compress
Next
From: Dean Rasheed
Date:
Subject: Re: MERGE ... RETURNING