| From: | Andreas Karlsson <andreas(at)proxel(dot)se> |
|---|---|
| To: | Japin Li <japinli(at)hotmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Add IS_INDEX macro to brin and gist index |
| Date: | 2026-01-14 02:38:10 |
| Message-ID: | 0708749e-69ce-41aa-bcac-52a4a595924d@proxel.se |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 1/14/26 2:56 AM, Japin Li wrote:
>
> Hi, hackers,
>
> While working on pageinspect [0], I noticed that brin_page_items() and
> gist_page_items() only checked the access method (IS_BRIN/IS_GIST) but did
> not verify that the passed relation is actually an index relation.
>
> To make the check more robust and consistent with other pageinspect index
> functions (like btreefuncs.c, hashfuncs.c, etc.), the attached patch:
>
> 1. Defines a local helper macro IS_INDEX(r) in both brinfuncs.c and gistfuncs.c.
>
> 2. Updates the error check to require both: the relation must be an index and
> use the expected access method.
>
> The change is very small, low-risk, and only affects two functions in
> contrib/pageinspect.
Since the two functions you touch are gist_page_items() and
brin_page_items() is there actually any harm from being able to use the
index definition from a partitioned when parsing the page? Seems
unnecessary to prevent people from doing so unless I am missing
something. It is not like we have any way to prevent the wrong index
from being used when parsing page the page so why prevent partitioned
indexes specifically?
Andreas
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2026-01-14 02:39:51 | Re: New year, new commitfest app improvements |
| Previous Message | Steven Niu | 2026-01-14 02:31:24 | Re: [PATCH] check kernel version for io_method |