agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
[PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
828+ messages / 1 participants
[nested] [flat]

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v16 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index b6574083b0a..33c0620a5c1 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v16-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread

* [PATCH v15 1/3] Modernize coding in GIN pageinspect functions.
@ 2026-01-07 19:38  reshke <reshke@double.cloud>
  0 siblings, 0 replies; 828+ messages in thread

From: reshke @ 2026-01-07 19:38 UTC (permalink / raw)

This patch switches palloc to our newly preferred palloc_array and modernizes
ereport calls, switching from list-style to polymorphic ereport
calls. This patch also fixes whitespace/tab issues, enforcing a single style.
across existing ginfuncs.c code.

Inspired by Peter Eisentraut's patch in the thread.

Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>

Discussion: https://postgr.es/m/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E=g=g6aZANyE_OoQ@mail.gmail.com
---
 contrib/pageinspect/ginfuncs.c | 58 +++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c
index ebcc2b3db5c..b7bd7a3f4cd 100644
--- a/contrib/pageinspect/ginfuncs.c
+++ b/contrib/pageinspect/ginfuncs.c
@@ -38,8 +38,8 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	page = get_page_from_raw(raw_page);
 
@@ -48,20 +48,20 @@ gin_metapage_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN metapage"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN metapage"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
 	if (opaq->flags != GIN_META)
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a GIN metapage"),
-				 errdetail("Flags %04X, expected %04X",
-						   opaq->flags, GIN_META)));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a GIN metapage"),
+				errdetail("Flags %04X, expected %04X",
+						  opaq->flags, GIN_META));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -118,11 +118,11 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
 
 	if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("input page is not a valid GIN data leaf page"),
-				 errdetail("Expected special size %d, got %d.",
-						   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-						   (int) PageGetSpecialSize(page))));
+				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("input page is not a valid GIN data leaf page"),
+				errdetail("Expected special size %d, got %d.",
+						  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+						  (int) PageGetSpecialSize(page)));
 
 	opaq = GinPageGetOpaque(page);
 
@@ -184,8 +184,8 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 	if (!superuser())
 		ereport(ERROR,
-				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("must be superuser to use raw page functions")));
+				errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				errmsg("must be superuser to use raw page functions"));
 
 	if (SRF_IS_FIRSTCALL())
 	{
@@ -207,20 +207,20 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		if (PageGetSpecialSize(page) != MAXALIGN(sizeof(GinPageOpaqueData)))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a valid GIN data leaf page"),
-					 errdetail("Expected special size %d, got %d.",
-							   (int) MAXALIGN(sizeof(GinPageOpaqueData)),
-							   (int) PageGetSpecialSize(page))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a valid GIN data leaf page"),
+					errdetail("Expected special size %d, got %d.",
+							  (int) MAXALIGN(sizeof(GinPageOpaqueData)),
+							  (int) PageGetSpecialSize(page)));
 
 		opaq = GinPageGetOpaque(page);
 		if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
 			ereport(ERROR,
-					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("input page is not a compressed GIN data leaf page"),
-					 errdetail("Flags %04X, expected %04X",
-							   opaq->flags,
-							   (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("input page is not a compressed GIN data leaf page"),
+					errdetail("Flags %04X, expected %04X",
+							  opaq->flags,
+							  (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)));
 
 		inter_call_data = palloc_object(gin_leafpage_items_state);
 
@@ -262,7 +262,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
 
 		/* build an array of decoded item pointers */
 		tids = ginPostingListDecode(cur, &ndecoded);
-		tids_datum = (Datum *) palloc(ndecoded * sizeof(Datum));
+		tids_datum = palloc_array(Datum, ndecoded);
 		for (i = 0; i < ndecoded; i++)
 			tids_datum[i] = ItemPointerGetDatum(&tids[i]);
 		values[2] = PointerGetDatum(construct_array_builtin(tids_datum, ndecoded, TIDOID));
-- 
2.43.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v15-0002-GIN-pageinspect-support-for-entry-tree-and-posti.patch



^ permalink  raw  reply  [nested|flat] 828+ messages in thread


end of thread, other threads:[~2026-01-07 19:38 UTC | newest]

Thread overview: 828+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v16 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>
2026-01-07 19:38 [PATCH v15 1/3] Modernize coding in GIN pageinspect functions. reshke <reshke@double.cloud>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox