From 0dc712fab1c53537ce1ad38d457a454d941cf41a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81lvaro=20Herrera?= <alvherre@kurilemu.de>
Date: Thu, 2 Apr 2026 20:10:17 +0200
Subject: [PATCH 4/5] don't include bufmgr.h in gin_private.h

---
 contrib/amcheck/verify_gin.c           | 1 +
 src/backend/access/common/reloptions.c | 1 +
 src/backend/access/gin/ginbtree.c      | 1 +
 src/backend/access/gin/gindatapage.c   | 1 +
 src/backend/access/gin/ginentrypage.c  | 1 +
 src/backend/access/gin/ginfast.c       | 1 +
 src/backend/access/gin/ginget.c        | 1 +
 src/backend/access/gin/ginscan.c       | 1 +
 src/backend/access/gin/ginutil.c       | 1 +
 src/include/access/gin_private.h       | 6 +++++-
 10 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/contrib/amcheck/verify_gin.c b/contrib/amcheck/verify_gin.c
index abfad07d5e4..e9fe1e3b53b 100644
--- a/contrib/amcheck/verify_gin.c
+++ b/contrib/amcheck/verify_gin.c
@@ -25,6 +25,7 @@
 #include "access/gin_private.h"
 #include "access/nbtree.h"
 #include "catalog/pg_am.h"
+#include "storage/bufmgr.h"
 #include "utils/memutils.h"
 #include "utils/rel.h"
 #include "verify_common.h"
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index b41eafd7691..0632e40a25b 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -28,6 +28,7 @@
 #include "commands/defrem.h"
 #include "commands/tablespace.h"
 #include "nodes/makefuncs.h"
+#include "storage/bufmgr.h"
 #include "storage/lock.h"
 #include "utils/array.h"
 #include "utils/attoptcache.h"
diff --git a/src/backend/access/gin/ginbtree.c b/src/backend/access/gin/ginbtree.c
index 3d3a9da56b1..54286793507 100644
--- a/src/backend/access/gin/ginbtree.c
+++ b/src/backend/access/gin/ginbtree.c
@@ -18,6 +18,7 @@
 #include "access/ginxlog.h"
 #include "access/xloginsert.h"
 #include "miscadmin.h"
+#include "storage/bufmgr.h"
 #include "storage/predicate.h"
 #include "utils/injection_point.h"
 #include "utils/memutils.h"
diff --git a/src/backend/access/gin/gindatapage.c b/src/backend/access/gin/gindatapage.c
index c5d7db28077..3956cc4f39b 100644
--- a/src/backend/access/gin/gindatapage.c
+++ b/src/backend/access/gin/gindatapage.c
@@ -19,6 +19,7 @@
 #include "access/xloginsert.h"
 #include "lib/ilist.h"
 #include "miscadmin.h"
+#include "storage/bufmgr.h"
 #include "storage/predicate.h"
 #include "utils/rel.h"
 
diff --git a/src/backend/access/gin/ginentrypage.c b/src/backend/access/gin/ginentrypage.c
index f818132eceb..202d21ad2a1 100644
--- a/src/backend/access/gin/ginentrypage.c
+++ b/src/backend/access/gin/ginentrypage.c
@@ -17,6 +17,7 @@
 #include "access/gin_private.h"
 #include "access/ginxlog.h"
 #include "access/xloginsert.h"
+#include "storage/bufmgr.h"
 #include "utils/rel.h"
 
 static void entrySplitPage(GinBtree btree, Buffer origbuf,
diff --git a/src/backend/access/gin/ginfast.c b/src/backend/access/gin/ginfast.c
index f50848eb65a..c8c57d7e681 100644
--- a/src/backend/access/gin/ginfast.c
+++ b/src/backend/access/gin/ginfast.c
@@ -27,6 +27,7 @@
 #include "miscadmin.h"
 #include "port/pg_bitutils.h"
 #include "postmaster/autovacuum.h"
+#include "storage/bufmgr.h"
 #include "storage/indexfsm.h"
 #include "storage/lmgr.h"
 #include "storage/predicate.h"
diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c
index 6b148e69a8e..2d321e3b7ee 100644
--- a/src/backend/access/gin/ginget.c
+++ b/src/backend/access/gin/ginget.c
@@ -18,6 +18,7 @@
 #include "access/relscan.h"
 #include "common/pg_prng.h"
 #include "miscadmin.h"
+#include "storage/bufmgr.h"
 #include "storage/predicate.h"
 #include "utils/datum.h"
 #include "utils/memutils.h"
diff --git a/src/backend/access/gin/ginscan.c b/src/backend/access/gin/ginscan.c
index fb929761ab7..88b15f0e221 100644
--- a/src/backend/access/gin/ginscan.c
+++ b/src/backend/access/gin/ginscan.c
@@ -18,6 +18,7 @@
 #include "access/relscan.h"
 #include "executor/instrument_node.h"
 #include "pgstat.h"
+#include "storage/bufmgr.h"
 #include "utils/memutils.h"
 #include "utils/rel.h"
 
diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c
index fe7b984ff32..a8171e5c95e 100644
--- a/src/backend/access/gin/ginutil.c
+++ b/src/backend/access/gin/ginutil.c
@@ -23,6 +23,7 @@
 #include "commands/progress.h"
 #include "commands/vacuum.h"
 #include "miscadmin.h"
+#include "storage/bufmgr.h"
 #include "storage/indexfsm.h"
 #include "utils/builtins.h"
 #include "utils/index_selfuncs.h"
diff --git a/src/include/access/gin_private.h b/src/include/access/gin_private.h
index 4445d088fa0..0e7bf3ec8a8 100644
--- a/src/include/access/gin_private.h
+++ b/src/include/access/gin_private.h
@@ -20,7 +20,11 @@
 #include "fmgr.h"
 #include "lib/rbtree.h"
 #include "nodes/tidbitmap.h"
-#include "storage/bufmgr.h"
+
+/*
+ * forward references in this file
+ */
+typedef int Buffer;
 
 /*
  * Storage type for GIN's reloptions
-- 
2.47.3

