v1-0001-Use-concurrent-delete-in-serialization-error-for-.patch
application/octet-stream
Filename: v1-0001-Use-concurrent-delete-in-serialization-error-for-.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v1-0001
Subject: Use "concurrent delete" in serialization error for TM_Deleted cases
| File | + | − |
|---|---|---|
| src/backend/executor/nodeLockRows.c | 1 | 1 |
| src/backend/utils/adt/ri_triggers.c | 1 | 1 |
| src/test/isolation/expected/fk-partitioned-2.out | 2 | 2 |
| src/test/isolation/expected/fk-snapshot-2.out | 2 | 2 |
| src/test/isolation/expected/fk-snapshot-3.out | 2 | 2 |
From 46fe8a2414c45ad324d0dbaea85bad2ca1b676c2 Mon Sep 17 00:00:00 2001
From: Amit Langote <amitlan@postgresql.org>
Date: Mon, 27 Apr 2026 13:48:35 +0900
Subject: [PATCH v1] Use "concurrent delete" in serialization error for
TM_Deleted cases
In ExecLockRows() and ri_LockPKTuple(), the TM_Deleted code path was
using the same "could not serialize access due to concurrent update"
message as the TM_Updated path. Use "concurrent delete" instead, since
the tuple was deleted, not updated. The ExecLockRows() instance was
likely a copy-paste error per Andres; the ri_LockPKTuple() instance
was carried over from the same pattern in commit 2da86c1ef9.
Update affected isolation test expected files accordingly.
The ExecLockRows() change is master-only for the lack of user
complaints.
Reported-by: jian he <jian.universality@gmail.com>
Author: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>
Discussion: https://postgr.es/m/CACJufxEG1JTCq4A1gnNAu-bGAq9Xn=Xkf7kC3TRWFz6iuUOuRA@mail.gmail.com
---
src/backend/executor/nodeLockRows.c | 2 +-
src/backend/utils/adt/ri_triggers.c | 2 +-
src/test/isolation/expected/fk-partitioned-2.out | 4 ++--
src/test/isolation/expected/fk-snapshot-2.out | 4 ++--
src/test/isolation/expected/fk-snapshot-3.out | 4 ++--
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/backend/executor/nodeLockRows.c b/src/backend/executor/nodeLockRows.c
index 8d865470780..3bee818a8b4 100644
--- a/src/backend/executor/nodeLockRows.c
+++ b/src/backend/executor/nodeLockRows.c
@@ -234,7 +234,7 @@ lnext:
if (IsolationUsesXactSnapshot())
ereport(ERROR,
(errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
- errmsg("could not serialize access due to concurrent update")));
+ errmsg("could not serialize access due to concurrent delete")));
/* tuple was deleted so don't return it */
goto lnext;
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c
index f63a7f0b580..dc89c686394 100644
--- a/src/backend/utils/adt/ri_triggers.c
+++ b/src/backend/utils/adt/ri_triggers.c
@@ -3244,7 +3244,7 @@ ri_LockPKTuple(Relation pk_rel, TupleTableSlot *slot, Snapshot snap,
if (IsolationUsesXactSnapshot())
ereport(ERROR,
(errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
- errmsg("could not serialize access due to concurrent update")));
+ errmsg("could not serialize access due to concurrent delete")));
return false;
case TM_Updated:
diff --git a/src/test/isolation/expected/fk-partitioned-2.out b/src/test/isolation/expected/fk-partitioned-2.out
index db621bee2d6..fd3d97c832f 100644
--- a/src/test/isolation/expected/fk-partitioned-2.out
+++ b/src/test/isolation/expected/fk-partitioned-2.out
@@ -22,7 +22,7 @@ step s2bs: begin isolation level serializable; select 1;
step s2i: insert into pfk values (1); <waiting ...>
step s1c: commit;
step s2i: <... completed>
-ERROR: could not serialize access due to concurrent update
+ERROR: could not serialize access due to concurrent delete
step s2c: commit;
starting permutation: s1b s2b s1d s2i s1c s2c
@@ -47,7 +47,7 @@ step s1d: delete from ppk where a = 1;
step s2i: insert into pfk values (1); <waiting ...>
step s1c: commit;
step s2i: <... completed>
-ERROR: could not serialize access due to concurrent update
+ERROR: could not serialize access due to concurrent delete
step s2c: commit;
starting permutation: s1b s2b s2i s1d s2c s1c
diff --git a/src/test/isolation/expected/fk-snapshot-2.out b/src/test/isolation/expected/fk-snapshot-2.out
index 0a4c9646fca..7333643e9ac 100644
--- a/src/test/isolation/expected/fk-snapshot-2.out
+++ b/src/test/isolation/expected/fk-snapshot-2.out
@@ -17,7 +17,7 @@ step s1del: DELETE FROM parent WHERE parent_id = 1;
step s2ins: INSERT INTO child VALUES (1, 1); <waiting ...>
step s1c: COMMIT;
step s2ins: <... completed>
-ERROR: could not serialize access due to concurrent update
+ERROR: could not serialize access due to concurrent delete
step s2c: COMMIT;
starting permutation: s1rc s2rc s2ins s1del s2c s1c
@@ -57,5 +57,5 @@ step s1del: DELETE FROM parent WHERE parent_id = 1;
step s2ins: INSERT INTO child VALUES (1, 1); <waiting ...>
step s1c: COMMIT;
step s2ins: <... completed>
-ERROR: could not serialize access due to concurrent update
+ERROR: could not serialize access due to concurrent delete
step s2c: COMMIT;
diff --git a/src/test/isolation/expected/fk-snapshot-3.out b/src/test/isolation/expected/fk-snapshot-3.out
index f98cb72fdac..2dc490be48b 100644
--- a/src/test/isolation/expected/fk-snapshot-3.out
+++ b/src/test/isolation/expected/fk-snapshot-3.out
@@ -21,7 +21,7 @@ step s2ins:
<waiting ...>
step s1c: COMMIT;
step s2ins: <... completed>
-ERROR: could not serialize access due to concurrent update
+ERROR: could not serialize access due to concurrent delete
step s2c: COMMIT;
starting permutation: s1rc s2rc s2ins s1del s2c s1c
@@ -69,7 +69,7 @@ step s2ins:
<waiting ...>
step s1c: COMMIT;
step s2ins: <... completed>
-ERROR: could not serialize access due to concurrent update
+ERROR: could not serialize access due to concurrent delete
step s2c: COMMIT;
starting permutation: s1rc s2rc s2ins s1upok s2c s1c
--
2.47.3