pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: cuiziyu20@otcaix.iscas.ac.cn
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19081: Inconsistent target rows seen by the UPDATE and INSERT statements within the same transaction
Date: Thu, 09 Oct 2025 13:17:52 -0400
Message-ID: <3080220.1760030272@sss.pgh.pa.us> (raw)
In-Reply-To: <19081-3745d3e571c420de@postgresql.org>
References: <19081-3745d3e571c420de@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> After transaction 1 was committed, the second INSERT in transaction 2
> successfully inserted the value (0, 12) because transaction 1 had updated
> the row (0, 0). However, the UPDATE in transaction 2 did not update the row
> (5, 5) that were updated in transaction 1.
> The final database result seems to indicate that the second INSERT in
> transaction 2 can see the update made by transaction 1, but the UPDATE in
> transaction 2 cannot see the update made by transaction 1. Why do these two
> statements show different effects when exposed to the influence of
> transaction 1?

I don't see any particular contradiction here.  At the time of T2's
second INSERT, the removal of the original (0, 0) row has already
committed, so there is no reason to disallow that INSERT.

REPEATABLE READ does not intend to promise no serialization anomalies.
SERIALIZABLE mode is a better approximation to that if you need it,
though it has its own downsides.

			regards, tom lane





view thread (3+ messages)  latest in thread

Message-ID: <3080220.1760030272@sss.pgh.pa.us>
Permalink:  ../3080220.1760030272@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3080220.1760030272@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, cuiziyu20@otcaix.iscas.ac.cn, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #19081: Inconsistent target rows seen by the UPDATE and INSERT statements within the same transaction
  In-Reply-To: <3080220.1760030272@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox