From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | cuiziyu20(at)otcaix(dot)iscas(dot)ac(dot)cn |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #19081: Inconsistent target rows seen by the UPDATE and INSERT statements within the same transaction |
Date: | 2025-10-09 17:17:52 |
Message-ID: | 3080220.1760030272@sss.pgh.pa.us |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
PG Bug reporting form <noreply(at)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Zane Duffield | 2025-10-09 23:43:04 | Date/Time parsing of ISO 8601 timestamps with commas |
Previous Message | Jeff Davis | 2025-10-09 16:56:24 | Re: BUG #19078: Segfaults in tts_minimal_store_tuple() following pg_upgrade |