From: | Miles Elam <miles(dot)elam(at)productops(dot)com> |
---|---|
To: | PG-General Mailing List <pgsql-general(at)postgresql(dot)org> |
Subject: | MERGE RETURNING |
Date: | 2022-11-23 19:02:44 |
Message-ID: | CAALojA-wDNCx-4XDTWfMouZZ5cNczMwzdWk79Jh7Ng5iBX+VfQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Are there any plans to (or specific decisions not to) support a RETURNING
clause on MERGE statements in future versions of Postgres? The only
reference I could find in the mailing list archives was this comment, which
suggested it was desired but simply not technically feasible at the time.
https://www.postgresql.org/message-id/202203161918.qz6phlortw2w@alvherre.pgsql
e.g.
MERGE INTO customer_account ca
USING (SELECT customer_id, transaction_value FROM recent_transactions) AS t
ON t.customer_id = ca.customer_id
WHEN MATCHED THEN
UPDATE SET balance = balance + transaction_value
WHEN NOT MATCHED THEN
INSERT (customer_id, balance)
VALUES (t.customer_id, t.transaction_value)
RETURNING customer_account.*;
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2022-11-23 19:11:52 | Re: MERGE RETURNING |
Previous Message | Adrian Klaver | 2022-11-23 16:16:16 | Re: Fwd: Change the auth. postgresql and GIS |