From: Nathan Bossart <nathandbossart@gmail.com>
To: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Ayush Vatsa <ayushvatsa1810@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Cc: Michael Paquier <michael@paquier.xyz>
Subject: Re: Pgstattuple on Sequences: Seeking Community Feedback on Potential Patch
Date: Tue, 3 Sep 2024 15:40:53 -0500
Message-ID: <Ztd0VcV2PQJf5jUJ@nathan> (raw)
In-Reply-To: <CAEze2WiNB=wjrtQGERk2mmkpOZevGCfTT7ei6guJsFG4VRmacA@mail.gmail.com>
References: <CACX+KaP3i+i9tdPLjF5JCHVv93xobEdcd_eB+638VDvZ3i=cQA@mail.gmail.com>
<Zsy6w_yW2QKYSo_m@nathan>
<CA+TgmoYm0X=KuHry1A6prNzf3pUmAcXYgQEr25kCY8jSMJaVjg@mail.gmail.com>
<ZszGBMK1D4hCsRnD@nathan>
<CACX+KaNhg-ZwkqCSjsq7j_gRYDmHip2b4kwa6ohac0MspSeW9w@mail.gmail.com>
<ZtCxo95K_bqGbmNQ@nathan>
<CA+TgmoaHX9BYrr1u9c356ovGwVBy25Q9y_LdSYS8JW0pqd18JA@mail.gmail.com>
<ZtI0O-bN90P02oQO@nathan>
<CAEze2WiNB=wjrtQGERk2mmkpOZevGCfTT7ei6guJsFG4VRmacA@mail.gmail.com>
On Tue, Sep 03, 2024 at 10:19:33PM +0200, Matthias van de Meent wrote:
> On Fri, 30 Aug 2024, 23:06 Nathan Bossart, <nathandbossart@gmail.com> wrote:
>> Another related inconsistency I just noticed in pageinspect:
>>
>> postgres=# select t_data from heap_page_items(get_raw_page('s', 0));
>> t_data
>> --------------------------------------
>> \x0100000000000000000000000000000000
>> (1 row)
>>
>> postgres=# select tuple_data_split('s'::regclass, t_data, t_infomask, t_infomask2, t_bits) from heap_page_items(get_raw_page('s', 0));
>> ERROR: only heap AM is supported
>
> I don't think this is an inconsistency:
>
> heap_page_items works on a raw page-as-bytea (produced by
> get_raw_page) without knowing about or accessing the actual relation
> type of that page, so it doesn't have the context why it should error
> out if the page looks similar enough to a heap page. I could feed it
> an arbitrary bytea, and it should still work as long as that bytea
> looks similar enough to a heap page.
> tuple_data_split, however, uses the regclass to decode the contents of
> the tuple, and can thus determine with certainty based on that
> regclass that it was supplied incorrect (non-heapAM table's regclass)
> arguments. It therefore has enough context to bail out and stop trying
> to decode the page's tuple data.
My point is really that tuple_data_split() needlessly ERRORs for sequences.
Other heap functions work fine for sequences, and we know it uses the heap
table AM, so why should tuple_data_split() fail? I agree that the others
needn't enforce relkind checks and that they might succeed in some cases
where tuple_data_split() might not be appropriate.
--
nathan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: nathandbossart@gmail.com, boekewurm+postgres@gmail.com, robertmhaas@gmail.com, ayushvatsa1810@gmail.com, michael@paquier.xyz
Subject: Re: Pgstattuple on Sequences: Seeking Community Feedback on Potential Patch
In-Reply-To: <Ztd0VcV2PQJf5jUJ@nathan>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox