]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Report tuple address in data-corruption error message
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 30 Aug 2021 20:29:12 +0000 (16:29 -0400)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 30 Aug 2021 20:29:12 +0000 (16:29 -0400)
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 fd6ec93bf890 for
13 and later.

Discussion: https://postgr.es/m/202108191637.oqyzrdtnheir@alvherre.pgsql

src/backend/access/heap/heapam_handler.c

index 1b8b640012a660e1f04b17395fe52cbeb0aee250..d1192e6a0c5bcf763b2a9f8992d9b790755427f7 100644 (file)
@@ -424,7 +424,11 @@ tuple_lock_retry:
                                        if (TransactionIdIsValid(SnapshotDirty.xmin))
                                                ereport(ERROR,
                                                                (errcode(ERRCODE_DATA_CORRUPTED),
-                                                                errmsg_internal("t_xmin is uncommitted in tuple to be updated")));
+                                                                errmsg_internal("t_xmin %u is uncommitted in tuple (%u,%u) to be updated in table \"%s\"",
+                                                                                                SnapshotDirty.xmin,
+                                                                                                ItemPointerGetBlockNumber(&tuple->t_self),
+                                                                                                ItemPointerGetOffsetNumber(&tuple->t_self),
+                                                                                                RelationGetRelationName(relation))));
 
                                        /*
                                         * If tuple is being updated by other transaction then we