From e33fc1a37354d2de8294aa238168c5dd4534c5a7 Mon Sep 17 00:00:00 2001
From: "Chao Li (Evan)" <lic@highgo.com>
Date: Fri, 12 Dec 2025 16:39:06 +0800
Subject: [PATCH v2 1/2] pageinspect: use index_close() for GiST index relation

gist_page_items() opens the target relation as an index, but closed it
using relation_close().  While this happened to work, it is inconsistent
with the index access APIs and bypasses the relkind checks enforced by
index_close().

Switch to index_close() for clarity and correctness.

Author: Chao Li <lic@highgo.com>
Discussion: https://postgr.es/m/CAEoWx2=bL41WWcD-4Fxx-buS2Y2G5=9PjkxZbHeFMR6Uy2WNvw@mail.gmail.com
---
 contrib/pageinspect/gistfuncs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/pageinspect/gistfuncs.c b/contrib/pageinspect/gistfuncs.c
index de3746a156b..414513c395b 100644
--- a/contrib/pageinspect/gistfuncs.c
+++ b/contrib/pageinspect/gistfuncs.c
@@ -361,7 +361,7 @@ gist_page_items(PG_FUNCTION_ARGS)
 		tuplestore_putvalues(rsinfo->setResult, rsinfo->setDesc, values, nulls);
 	}
 
-	relation_close(indexRel, AccessShareLock);
+	index_close(indexRel, AccessShareLock);
 
 	return (Datum) 0;
 }
-- 
2.39.5 (Apple Git-154)

