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

---
 contrib/pageinspect/hashfuncs.c      | 1 +
 src/backend/access/hash/hashinsert.c | 1 +
 src/backend/access/hash/hashovfl.c   | 1 +
 src/backend/access/hash/hashpage.c   | 1 +
 src/backend/access/hash/hashsearch.c | 1 +
 src/backend/access/hash/hashutil.c   | 1 +
 src/include/access/hash.h            | 6 +++++-
 7 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/contrib/pageinspect/hashfuncs.c b/contrib/pageinspect/hashfuncs.c
index 7fc97d043ce..9fe4e53ff20 100644
--- a/contrib/pageinspect/hashfuncs.c
+++ b/contrib/pageinspect/hashfuncs.c
@@ -18,6 +18,7 @@
 #include "funcapi.h"
 #include "miscadmin.h"
 #include "pageinspect.h"
+#include "storage/bufmgr.h"
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/rel.h"
diff --git a/src/backend/access/hash/hashinsert.c b/src/backend/access/hash/hashinsert.c
index 3395bbc13f8..d342dacfc3e 100644
--- a/src/backend/access/hash/hashinsert.c
+++ b/src/backend/access/hash/hashinsert.c
@@ -19,6 +19,7 @@
 #include "access/hash_xlog.h"
 #include "access/xloginsert.h"
 #include "miscadmin.h"
+#include "storage/bufmgr.h"
 #include "storage/predicate.h"
 #include "utils/rel.h"
 
diff --git a/src/backend/access/hash/hashovfl.c b/src/backend/access/hash/hashovfl.c
index dbc57ef958c..039b4083a3e 100644
--- a/src/backend/access/hash/hashovfl.c
+++ b/src/backend/access/hash/hashovfl.c
@@ -21,6 +21,7 @@
 #include "access/hash_xlog.h"
 #include "access/xloginsert.h"
 #include "miscadmin.h"
+#include "storage/bufmgr.h"
 #include "utils/rel.h"
 
 
diff --git a/src/backend/access/hash/hashpage.c b/src/backend/access/hash/hashpage.c
index 8099b0d021f..46f4c3b844c 100644
--- a/src/backend/access/hash/hashpage.c
+++ b/src/backend/access/hash/hashpage.c
@@ -33,6 +33,7 @@
 #include "access/xloginsert.h"
 #include "miscadmin.h"
 #include "port/pg_bitutils.h"
+#include "storage/bufmgr.h"
 #include "storage/predicate.h"
 #include "storage/smgr.h"
 #include "utils/rel.h"
diff --git a/src/backend/access/hash/hashsearch.c b/src/backend/access/hash/hashsearch.c
index 89d1c5bc6d7..1e457b67bf3 100644
--- a/src/backend/access/hash/hashsearch.c
+++ b/src/backend/access/hash/hashsearch.c
@@ -19,6 +19,7 @@
 #include "miscadmin.h"
 #include "executor/instrument_node.h"
 #include "pgstat.h"
+#include "storage/bufmgr.h"
 #include "storage/predicate.h"
 #include "utils/rel.h"
 
diff --git a/src/backend/access/hash/hashutil.c b/src/backend/access/hash/hashutil.c
index 081adbc88a6..b6597e2e4f7 100644
--- a/src/backend/access/hash/hashutil.c
+++ b/src/backend/access/hash/hashutil.c
@@ -18,6 +18,7 @@
 #include "access/reloptions.h"
 #include "access/relscan.h"
 #include "port/pg_bitutils.h"
+#include "storage/bufmgr.h"
 #include "utils/lsyscache.h"
 #include "utils/rel.h"
 
diff --git a/src/include/access/hash.h b/src/include/access/hash.h
index a8702f0e5ea..07b658efbf0 100644
--- a/src/include/access/hash.h
+++ b/src/include/access/hash.h
@@ -23,11 +23,15 @@
 #include "catalog/pg_am_d.h"
 #include "common/hashfn.h"
 #include "lib/stringinfo.h"
-#include "storage/bufmgr.h"
 #include "storage/lockdefs.h"
 #include "utils/hsearch.h"
 #include "utils/relcache.h"
 
+/*
+ * forward declarations in this file
+ */
+typedef int Buffer;
+
 /*
  * Mapping from hash bucket number to physical block number of bucket's
  * starting page.  Beware of multiple evaluations of argument!
-- 
2.47.3

