pageinspect support for SpGiST
Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.
Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:
git clone --branch t53064_2 https://github.com/hackorum-dev/postgres.gitIn a checkout you already have, add the fork once:
git remote add hackorum https://github.com/hackorum-dev/postgres.gitthen, for this patchset and every later one:
git fetch hackorum t53064_2 && git checkout t53064_2Patchset v2 (message #2) is on t53064_2
Hi hackers!
I am currently working for amcheck & pageinspect support for SpGiST indices.
Here is a patch implementing the pageinspect part.
My current design is two functions, which are
* spgist_page_opaque_info - akin to gin/gist opaque info functions.
* spgist_page_items - function that returns information about tuples
on the SpGiST page. Currently this works only for LEAF pages, Internal
pages to be supported.
Following "Desirability -> Design -> Implement -> Test -> Review ->
Commit" developing process, posting v1 patch with PoC and looking for
Desirability/Design feedback.
PFA (WIP) v1.
--
Best regards,
Kirill Reshke
Attachments:
v1-0001-Add-pageinspect-support-for-SpGiST-indexes.patchapplication/octet-stream; name=v1-0001-Add-pageinspect-support-for-SpGiST-indexes.patchDownload+446-2
On Sat, 10 Jan 2026 at 23:05, I wrote:
Currently this works only for LEAF pages, Internal pages to be supported.
I have added the spgist_innerpage_items function to address that.
spgist_page_items renamed to spgist_leafpage_items
PFA v2
--
Best regards,
Kirill Reshke
On 11 Jan 2026, at 16:32, Kirill Reshke <reshkekirill@gmail.com> wrote:
PFA v2
Nice feature, it would be good to have in. Some nits:
1. File header is wrong — says "gistfuncs.c" and "GiST"
2. Traces of GiST are everywhere, in function names, in error messages, etc
3. spgist_metapage_items — wrong errdetail for magic number check ("Expected special size")
4. "values[6] = InvalidTransactionId;" more conventional would be "TransactionIdGetDatum(InvalidTransactionId)"
5. spgist_innerpage_items — has_datums used uninitialized in SPGIST_DEAD+ cases
6. spgist_innerpage_items — doesn't output prefix/node data, is it by design?
7. you use index_deform_tuple_internal() instead of spgDeformLeafTuple(), I'm not sure that's conventional also
8. "values[2] = UInt32GetDatum(leafTuple->size);" must be "values[2] = UInt16GetDatum(leafTuple->size);" according to "OUT size smallint,"?
9. "OUT blkno smallint," also raises sizing questions
Thanks for working on this!
Best regards, Andrey Borodin.