amcheck: Improve confusing message
authorPeter Eisentraut <[email protected]>
Tue, 1 Jul 2025 10:24:17 +0000 (12:24 +0200)
committerPeter Eisentraut <[email protected]>
Tue, 1 Jul 2025 10:24:17 +0000 (12:24 +0200)
The way it was worded, the %u placeholder could be read as the table
OID.  Rearrange slightly to avoid the possible confusion.

Reported-by: jian he <[email protected]>
Reviewed-by: Bertrand Drouvot <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/CACJufxFx-25XQV%2Br23oku7ZnL958P30hyb9cFeYPv6wv7yzCCw%40mail.gmail.com

contrib/amcheck/verify_heapam.c
src/bin/pg_amcheck/t/004_verify_heapam.pl

index aa9cccd1da4fe308ca966db90038284586a309bc..4963e9245cb54301a490b761c4890b6433fdd4f8 100644 (file)
@@ -1942,7 +1942,7 @@ check_tuple(HeapCheckContext *ctx, bool *xmin_commit_status_ok,
    if (RelationGetDescr(ctx->rel)->natts < ctx->natts)
    {
        report_corruption(ctx,
-                         psprintf("number of attributes %u exceeds maximum expected for table %u",
+                         psprintf("number of attributes %u exceeds maximum %u expected for table",
                                   ctx->natts,
                                   RelationGetDescr(ctx->rel)->natts));
        return;
index 2a3af2666f52ac11244c816dd51544813c7efcbe..72693660fb64beb21959271d5b67f5b599862247 100644 (file)
@@ -529,7 +529,7 @@ for (my $tupidx = 0; $tupidx < $ROWCOUNT; $tupidx++)
        $tup->{t_infomask2} |= HEAP_NATTS_MASK;
 
        push @expected,
-         qr/${$header}number of attributes 2047 exceeds maximum expected for table 3/;
+         qr/${$header}number of attributes 2047 exceeds maximum 3 expected for table/;
    }
    elsif ($offnum == 10)
    {
@@ -552,7 +552,7 @@ for (my $tupidx = 0; $tupidx < $ROWCOUNT; $tupidx++)
        $tup->{t_hoff} = 32;
 
        push @expected,
-         qr/${$header}number of attributes 67 exceeds maximum expected for table 3/;
+         qr/${$header}number of attributes 67 exceeds maximum 3 expected for table/;
    }
    elsif ($offnum == 12)
    {