Re: MERGE ... WHEN NOT MATCHED BY SOURCE - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: MERGE ... WHEN NOT MATCHED BY SOURCE
Date
Msg-id CAEZATCUBUHwdfks-jFGSk0+KgaGFLRB-qLB36X4tudQaaSCm7Q@mail.gmail.com
Whole thread Raw
In response to Re: MERGE ... WHEN NOT MATCHED BY SOURCE  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Responses Re: MERGE ... WHEN NOT MATCHED BY SOURCE
List pgsql-hackers
On Wed, 13 Mar 2024 at 14:32, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>
> Rebased version attached.
>

Rebased version attached, on top of c649fa24a4 (MERGE ... RETURNING support).

Aside from some cosmetic stuff, I've updated several tests to test
this together with RETURNING.

The updated isolation test tests the new interesting case where a
concurrent update causes a matched case to become not matched, and
there are both NOT MATCHED BY SOURCE and NOT MATCHED BY TARGET actions
to execute, and RETURNING is specified so that it is forced to defer
the NOT MATCHED BY TARGET action until the next invocation of
ExecModifyTable(), in order to return the rows from both not matched
actions.

I also tried to tidy up ExecMergeMatched() a little --- since we know
that it's only ever called with matched = true, it's simpler to just
Assert that at the top, and then only touch it in the few cases where
it needs to be changed to false.

A lot of the updates are comment updates, to try to make it clearer
how concurrent updates are handled, since that's a little more complex
with this patch.

Regards,
Dean

Attachment

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Skip collecting decoded changes of already-aborted transactions
Next
From: Bertrand Drouvot
Date:
Subject: Re: Autogenerate some wait events code and documentation