Skip to content

Commit fa8ae19

Browse files
committed
Report tuple address in data-corruption error message
Most data-corruption reports mention the location of the problem, but this one failed to. Add it. Backpatch all the way back. In 12 and older, also assign the ERRCODE_DATA_CORRUPTED error code as was done in commit fd6ec93 for 13 and later. Discussion: https://postgr.es/m/202108191637.oqyzrdtnheir@alvherre.pgsql
1 parent a3f6088 commit fa8ae19

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/backend/access/heap/heapam_handler.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,13 @@ heapam_tuple_lock(Relation relation, ItemPointer tid, Snapshot snapshot,
426426

427427
/* otherwise xmin should not be dirty... */
428428
if (TransactionIdIsValid(SnapshotDirty.xmin))
429-
elog(ERROR, "t_xmin is uncommitted in tuple to be updated");
429+
ereport(ERROR,
430+
(errcode(ERRCODE_DATA_CORRUPTED),
431+
errmsg_internal("t_xmin %u is uncommitted in tuple (%u,%u) to be updated in table \"%s\"",
432+
SnapshotDirty.xmin,
433+
ItemPointerGetBlockNumber(&tuple->t_self),
434+
ItemPointerGetOffsetNumber(&tuple->t_self),
435+
RelationGetRelationName(relation))));
430436

431437
/*
432438
* If tuple is being updated by other transaction then we

0 commit comments

Comments
 (0)