Re: Fix memory leak in gist_page_items() of pageinspect

Japin Li <japinli@hotmail.com>

From: Japin Li <japinli@hotmail.com>
To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>, Chao Li <li.evan.chao@gmail.com>, Daniel Gustafsson <daniel@yesql.se>, Heikki Linnakangas <hlinnaka@iki.fi>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-12-19T09:36:51Z
Lists: pgsql-hackers
On Fri, 19 Dec 2025 at 08:23, Bertrand Drouvot <bertranddrouvot.pg@gmail.com> wrote:
> Hi,
>
> On Fri, Dec 19, 2025 at 02:21:40PM +0800, Japin Li wrote:
>> On Fri, 19 Dec 2025 at 04:29, Bertrand Drouvot <bertranddrouvot.pg@gmail.com> wrote:
>> > Yeah, and removing IS_INDEX() and adding a check for partitioned indexes would
>> > still mean 2 code paths. So, v2 changes the close calls (and that's consistent
>> > with what pgstatginindex_internal() is doing.
>> >
>> 
>> It would be reasonable to add a comment explaining the choice of
>> relation_open()/relation_close() instead of the index-specific
>> index_open()/index_close().
>
> Yeah that would not hurt. What about before the relation_open() calls?
>
> "
> Use relation_open() and not index_open() to avoid the validate_relation_kind()
> check as we handle relation validation separately below.
> "
>

LGTM.

-- 
Regards,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.