Re: Enhance btree's pageinspect

From: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
To: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Enhance btree's pageinspect
Date: 2026-01-19 11:52:06
Message-ID: CAJ7c6TMY+aLtjwP21KwGu=8nL4qDuMRG2EG1Gr2gkD9dz1_KoQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Kirill,

> Please find two patches that would be very helpful to my own use
> cases, and I believe they are universally useful. v1-0001 provides
> pretty-print functionality for bt_page_items().
> This makes much easier to get which exactly data page contains

I did a quick look at 0001. Here are my two cents.

If you are changing bt_page_items() you should also update the
documentation [1] and cover the new functionality with tests.

Adding a new required argument to the existing function doesn't strike
me as a great idea. That's an API change which is arguably not that
necessary. On top of that, pretty-printing potentially corrupted data
may cause the backend to crash. IMO if we are going to do this the API
should be very clear about the danger. I would prefer having a
separate function, e.g. bt_page_items_unsafe. Or maybe this is
something better done with an external tool like pg_filedump.

Just thinking out loud. I wonder what other people think.

[1]: https://stream.boxwatch.ru/docs/current/pageinspect.html

--
Best regards,
Aleksander Alekseev

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shruthi Gowda 2026-01-19 12:08:29 Re: [BUG] CRASH: ECPGprepared_statement() and ECPGdeallocate_all() when connection is NULL
Previous Message Jakub Wartak 2026-01-19 11:47:19 Re: failed NUMA pages inquiry status: Operation not permitted