Skip to content

Commit 4078ce6

Browse files
committed
Fix a confusing amcheck corruption message.
Don't complain about the last TOAST chunk number being different from what we expected if there are no TOAST chunks at all. In such a case, saying that the final chunk number is 0 is not really accurate, and the fact the value is missing from the TOAST table is reported separately anyway. Mark Dilger Discussion: http://postgr.es/m/AA5506CE-7D2A-42E4-A51D-358635E3722D@enterprisedb.com
1 parent c6fc50c commit 4078ce6

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

contrib/amcheck/verify_heapam.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,14 +1100,14 @@ check_tuple_attribute(HeapCheckContext *ctx)
11001100
check_toast_tuple(toasttup, ctx);
11011101
ctx->chunkno++;
11021102
}
1103-
if (ctx->chunkno != (ctx->endchunk + 1))
1104-
report_corruption(ctx,
1105-
psprintf("final toast chunk number %u differs from expected value %u",
1106-
ctx->chunkno, (ctx->endchunk + 1)));
11071103
if (!found_toasttup)
11081104
report_corruption(ctx,
11091105
psprintf("toasted value for attribute %u missing from toast table",
11101106
ctx->attnum));
1107+
else if (ctx->chunkno != (ctx->endchunk + 1))
1108+
report_corruption(ctx,
1109+
psprintf("final toast chunk number %u differs from expected value %u",
1110+
ctx->chunkno, (ctx->endchunk + 1)));
11111111
systable_endscan_ordered(toastscan);
11121112

11131113
return true;

src/bin/pg_amcheck/t/004_verify_heapam.pl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ sub write_tuple
296296
$node->start;
297297

298298
# Ok, Xids and page layout look ok. We can run corruption tests.
299-
plan tests => 20;
299+
plan tests => 19;
300300

301301
# Check that pg_amcheck runs against the uncorrupted table without error.
302302
$node->command_ok(['pg_amcheck', '-p', $port, 'postgres'],
@@ -489,7 +489,6 @@ sub header
489489

490490
$header = header(0, $offnum, 2);
491491
push @expected,
492-
qr/${header}final toast chunk number 0 differs from expected value \d+/,
493492
qr/${header}toasted value for attribute 2 missing from toast table/;
494493
}
495494
elsif ($offnum == 14)

0 commit comments

Comments
 (0)