Re: confusing message in check_tuple

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: confusing message in check_tuple
Date: 2025-06-17 08:17:48
Message-ID: CACJufxFWkpF1tsmT8SB0K9iMA0kgmuKMELt=oW3H+gG0txonLA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 17, 2025 at 1:21 PM Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> On 12.06.25 08:26, jian he wrote:
> > in contrib/amcheck/verify_heapam.c, check_tuple
> > report_corruption(ctx,
> > psprintf("number of attributes %u exceeds
> > maximum expected for table %u",
> > ctx->natts,
> > RelationGetDescr(ctx->rel)->natts));
>
> Agreed this is misleading.
>
> > i think it should be
> > report_corruption(ctx,
> > psprintf("number of attributes %u exceeds
> > maximum expected for table %u",
> > ctx->natts,
> > RelationGetRelid(ctx->rel)));
> >
> > or we can rephrase it another way, also mentioning
> > ``RelationGetDescr(ctx->rel)->natts``.
>
> I think they did want to mention RelationGetDescr(ctx->rel)->natts. How
> about
>
> "number of attributes %u exceeds maximum expected for table (%u)"
>

ctx->natts is "int", so it should be
psprintf( "number of attributes %d exceeds maximum expected for table (%u)",
ctx->natts, RelationGetRelid(ctx->rel));
?

we also need change src/bin/pg_amcheck/t/004_verify_heapam.pl
in there, we have

push @expected,
qr/${$header}number of attributes 67 exceeds maximum
expected for table 3/;

push @expected,
qr/${$header}number of attributes 2047 exceeds maximum
expected for table 3/;

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mats Kindahl 2025-06-17 08:30:34 Transactional behavior of pg_create_logical_replication_slot
Previous Message Matt Smith (matts3) 2025-06-17 08:15:44 Re: [PATCH] Add an ldflags_sl meson build option