Re: Assert in pageinspect with NULL pages - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Assert in pageinspect with NULL pages
Date
Msg-id YjGjRMxZpCU8TpHb@paquier.xyz
Whole thread Raw
In response to Re: Assert in pageinspect with NULL pages  (Daria Lepikhova <d.lepikhova@postgrespro.ru>)
Responses Re: Assert in pageinspect with NULL pages
List pgsql-hackers
On Wed, Feb 23, 2022 at 12:09:02PM +0500, Daria Lepikhova wrote:
> And one more addition. In the previous version of the patch, I forgot to add
> tests for the gist index, but the described problem is also relevant for it.

So, I have looked at this second part of the thread, and concluded
that we should not fail for empty pages.  First, we fetch pages from
the buffer pool in normal mode, where empty pages are valid.  There is
also a second point in favor of doing so: code paths dedicated to hash
indexes already do that, marking such pages as simply "unused".  The
proposal from Julien upthread sounds cleaner to me though in the long
run, as NULL gives the user the possibility to do a full-table scan
with simple clauses to filter out anything found as NULL.

Painting more PageIsNew() across the place requires a bit more work
than a simple ereport(ERROR) in get_page_from_raw(), of course, but
the gain is the portability of the functions.

(One can have a lot of fun playing with random inputs and breaking
most code paths, but that's not new.)
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: Possible corruption by CreateRestartPoint at promotion
Next
From: Maxim Orlov
Date:
Subject: Re: Add 64-bit XIDs into PostgreSQL 15