v2-0002-Remove-brin-gin_tuple.h-from-tuplesort.h.patch

text/x-patch

Filename: v2-0002-Remove-brin-gin_tuple.h-from-tuplesort.h.patch
Type: text/x-patch
Part: 3
Message: Re: [PATCH} Move instrumentation structs

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v2-0002
Subject: Remove brin/gin_tuple.h from tuplesort.h
File+
contrib/pageinspect/gistfuncs.c 1 0
src/backend/access/gin/gininsert.c 1 0
src/backend/catalog/pg_attrdef.c 1 0
src/backend/catalog/pg_largeobject.c 1 0
src/backend/executor/execReplication.c 1 0
src/backend/parser/parse_expr.c 1 0
src/backend/replication/logical/relation.c 1 0
src/backend/replication/logical/sequencesync.c 1 0
src/backend/statistics/attribute_stats.c 1 0
src/include/nodes/execnodes.h 1 0
src/include/utils/tuplesort.h 3 2
From 3a21f9f3099c3979abf379bd53b367d8237214cf Mon Sep 17 00:00:00 2001
From: Mario Gonzalez <gonzalemario@gmail.com>
Date: Thu, 6 Nov 2025 17:50:36 -0300
Subject: [PATCH v2 2/4] Remove brin/gin_tuple.h from tuplesort.h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Because execnodes.h depends on struct definitions that were in genam.h,
which it no longer gets because of the aforementioned removal.

Author: Álvaro Herrera <alvherre@kurilemu.de>
co-author: Mario Gonzalez <gonzalemario@gmail.com>
---
 contrib/pageinspect/gistfuncs.c                | 1 +
 src/backend/access/gin/gininsert.c             | 1 +
 src/backend/catalog/pg_attrdef.c               | 1 +
 src/backend/catalog/pg_largeobject.c           | 1 +
 src/backend/executor/execReplication.c         | 1 +
 src/backend/parser/parse_expr.c                | 1 +
 src/backend/replication/logical/relation.c     | 1 +
 src/backend/replication/logical/sequencesync.c | 1 +
 src/backend/statistics/attribute_stats.c       | 1 +
 src/include/nodes/execnodes.h                  | 1 +
 src/include/utils/tuplesort.h                  | 5 +++--
 11 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/contrib/pageinspect/gistfuncs.c b/contrib/pageinspect/gistfuncs.c
index 414513c395b..d738d6519f6 100644
--- a/contrib/pageinspect/gistfuncs.c
+++ b/contrib/pageinspect/gistfuncs.c
@@ -9,6 +9,7 @@
  */
 #include "postgres.h"
 
+#include "access/genam.h"
 #include "access/gist.h"
 #include "access/htup.h"
 #include "access/htup_details.h"
diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c
index df30dcc0228..e71a08d541f 100644
--- a/src/backend/access/gin/gininsert.c
+++ b/src/backend/access/gin/gininsert.c
@@ -33,6 +33,7 @@
 #include "utils/memutils.h"
 #include "utils/rel.h"
 #include "utils/builtins.h"
+#include "utils/typcache.h"
 
 
 /* Magic numbers for parallel state sharing */
diff --git a/src/backend/catalog/pg_attrdef.c b/src/backend/catalog/pg_attrdef.c
index 29f5691bee9..e8bdb52cb00 100644
--- a/src/backend/catalog/pg_attrdef.c
+++ b/src/backend/catalog/pg_attrdef.c
@@ -14,6 +14,7 @@
  */
 #include "postgres.h"
 
+#include "access/genam.h"
 #include "access/htup_details.h"
 #include "access/relation.h"
 #include "access/table.h"
diff --git a/src/backend/catalog/pg_largeobject.c b/src/backend/catalog/pg_largeobject.c
index 33e8fa96a65..ada4c3685e0 100644
--- a/src/backend/catalog/pg_largeobject.c
+++ b/src/backend/catalog/pg_largeobject.c
@@ -14,6 +14,7 @@
  */
 #include "postgres.h"
 
+#include "access/genam.h"
 #include "access/htup_details.h"
 #include "access/table.h"
 #include "catalog/catalog.h"
diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c
index 860f79f9cc1..0431adfc82c 100644
--- a/src/backend/executor/execReplication.c
+++ b/src/backend/executor/execReplication.c
@@ -14,6 +14,7 @@
 
 #include "postgres.h"
 
+#include "access/amapi.h"
 #include "access/commit_ts.h"
 #include "access/genam.h"
 #include "access/gist.h"
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index 6b8fa15fca3..e374422d24d 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -38,6 +38,7 @@
 #include "utils/fmgroids.h"
 #include "utils/lsyscache.h"
 #include "utils/timestamp.h"
+#include "utils/typcache.h"
 #include "utils/xml.h"
 
 /* GUC parameters */
diff --git a/src/backend/replication/logical/relation.c b/src/backend/replication/logical/relation.c
index 2c8485b881f..c67f7e49a65 100644
--- a/src/backend/replication/logical/relation.c
+++ b/src/backend/replication/logical/relation.c
@@ -29,6 +29,7 @@
 #include "utils/inval.h"
 #include "utils/lsyscache.h"
 #include "utils/syscache.h"
+#include "utils/typcache.h"
 
 
 static MemoryContext LogicalRepRelMapContext = NULL;
diff --git a/src/backend/replication/logical/sequencesync.c b/src/backend/replication/logical/sequencesync.c
index 019e5ec6a7d..0eeffcbcf45 100644
--- a/src/backend/replication/logical/sequencesync.c
+++ b/src/backend/replication/logical/sequencesync.c
@@ -52,6 +52,7 @@
 #include "postgres.h"
 
 #include "access/table.h"
+#include "access/genam.h"
 #include "catalog/pg_sequence.h"
 #include "catalog/pg_subscription_rel.h"
 #include "commands/sequence.h"
diff --git a/src/backend/statistics/attribute_stats.c b/src/backend/statistics/attribute_stats.c
index ef4d768feab..9ccc04da3ef 100644
--- a/src/backend/statistics/attribute_stats.c
+++ b/src/backend/statistics/attribute_stats.c
@@ -31,6 +31,7 @@
 #include "utils/fmgroids.h"
 #include "utils/lsyscache.h"
 #include "utils/syscache.h"
+#include "utils/typcache.h"
 
 #define DEFAULT_NULL_FRAC      Float4GetDatum(0.0)
 #define DEFAULT_AVG_WIDTH      Int32GetDatum(0) /* unknown */
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index f421a52c16d..425d09d2027 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -29,6 +29,7 @@
 #ifndef EXECNODES_H
 #define EXECNODES_H
 
+#include "access/skey.h"
 #include "access/tupconvert.h"
 #include "executor/instrument.h"
 #include "fmgr.h"
diff --git a/src/include/utils/tuplesort.h b/src/include/utils/tuplesort.h
index 7261345d217..ea008e3066f 100644
--- a/src/include/utils/tuplesort.h
+++ b/src/include/utils/tuplesort.h
@@ -21,8 +21,6 @@
 #ifndef TUPLESORT_H
 #define TUPLESORT_H
 
-#include "access/brin_tuple.h"
-#include "access/gin_tuple.h"
 #include "access/itup.h"
 #include "executor/instrument_node.h"
 #include "executor/tuptable.h"
@@ -31,6 +29,9 @@
 #include "utils/relcache.h"
 #include "utils/sortsupport.h"
 
+/* We don't want this file to depend on AM-specific header files */
+typedef struct BrinTuple BrinTuple;
+typedef struct GinTuple GinTuple;
 
 /*
  * Tuplesortstate and Sharedsort are opaque types whose details are not
-- 
2.39.5