Re: MERGE behavior with REPEATABLE READ isolation level

Dean Rasheed <dean.a.rasheed@gmail.com>

From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: Tender Wang <tndrwang@gmail.com>
Cc: Alexander Korotkov <aekorotkov@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-02-24T09:09:54Z
Lists: pgsql-hackers
On Tue, 24 Feb 2026 at 03:13, Tender Wang <tndrwang@gmail.com> wrote:
>
> Alexander Korotkov <aekorotkov@gmail.com> 于2026年2月15日周日 09:23写道:
> >
> > I found it strange that ExecMergeMatched() checks for IsolationUsesXactSnapshot() in the TM_Deleted case, but not in the TM_Updated case.
>
> I tried "update test set val = val + 100;" but the SQL reported a
> "could not serialize access due to concurrent update" error.
> It seems that the MERGE command should behave identically to UPDATE
> when performing a match action.
>

Yes, I agree. I think this is a bug (probably just an oversight in the
original MERGE commit).

Regards,
Dean



Commits

  1. Fix handling of updated tuples in the MERGE statement