From 2e03f3cb40d3c13637671b6c6d8d050820b39bb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81lvaro=20Herrera?= <alvherre@kurilemu.de>
Date: Thu, 2 Apr 2026 12:33:56 +0200
Subject: [PATCH v2 6/9] Don't include catalog/publication.h in utils/rel.h

---
 src/include/access/tableam.h           | 1 +
 src/include/replication/logicalproto.h | 1 +
 src/include/storage/lmgr.h             | 1 +
 src/include/utils/rel.h                | 5 ++++-
 src/backend/catalog/pg_shdepend.c      | 1 +
 src/backend/commands/alter.c           | 1 +
 src/backend/commands/lockcmds.c        | 1 +
 src/backend/commands/tablecmds.c       | 1 +
 contrib/pg_surgery/heap_surgery.c      | 1 +
 contrib/pgrowlocks/pgrowlocks.c        | 1 +
 10 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/include/access/tableam.h b/src/include/access/tableam.h
index 7f99203f965..61ba2476ed2 100644
--- a/src/include/access/tableam.h
+++ b/src/include/access/tableam.h
@@ -21,6 +21,7 @@
 #include "access/sdir.h"
 #include "access/xact.h"
 #include "executor/tuptable.h"
+#include "nodes/lockoptions.h"
 #include "utils/rel.h"
 
 
diff --git a/src/include/replication/logicalproto.h b/src/include/replication/logicalproto.h
index 058a955e20c..b4192b68174 100644
--- a/src/include/replication/logicalproto.h
+++ b/src/include/replication/logicalproto.h
@@ -14,6 +14,7 @@
 #define LOGICAL_PROTO_H
 
 #include "access/xact.h"
+#include "catalog/pg_publication.h"
 #include "executor/tuptable.h"
 #include "replication/reorderbuffer.h"
 #include "utils/rel.h"
diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h
index 2a985ce5e15..9dae6a15560 100644
--- a/src/include/storage/lmgr.h
+++ b/src/include/storage/lmgr.h
@@ -16,6 +16,7 @@
 
 #include "lib/stringinfo.h"
 #include "storage/itemptr.h"
+#include "storage/lockdefs.h"
 #include "storage/locktag.h"
 #include "utils/rel.h"
 
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 236830f6b93..9b4e4e00cc0 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -19,7 +19,6 @@
 #include "catalog/catalog.h"
 #include "catalog/pg_class.h"
 #include "catalog/pg_index.h"
-#include "catalog/pg_publication.h"
 #include "nodes/bitmapset.h"
 #include "partitioning/partdefs.h"
 #include "rewrite/prs2lock.h"
@@ -29,6 +28,10 @@
 #include "utils/relcache.h"
 #include "utils/reltrigger.h"
 
+/*
+ * forward references in this file
+ */
+typedef struct PublicationDesc PublicationDesc;
 
 /*
  * LockRelId and LockInfo really belong to lmgr.h, but it's more convenient
diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c
index c9998531b2f..bbb60dd565a 100644
--- a/src/backend/catalog/pg_shdepend.c
+++ b/src/backend/catalog/pg_shdepend.c
@@ -38,6 +38,7 @@
 #include "catalog/pg_operator.h"
 #include "catalog/pg_opfamily.h"
 #include "catalog/pg_proc.h"
+#include "catalog/pg_publication.h"
 #include "catalog/pg_shdepend.h"
 #include "catalog/pg_statistic_ext.h"
 #include "catalog/pg_subscription.h"
diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c
index 74ceb5fe20d..6fbeb69ba96 100644
--- a/src/backend/commands/alter.c
+++ b/src/backend/commands/alter.c
@@ -35,6 +35,7 @@
 #include "catalog/pg_operator.h"
 #include "catalog/pg_opfamily.h"
 #include "catalog/pg_proc.h"
+#include "catalog/pg_publication.h"
 #include "catalog/pg_statistic_ext.h"
 #include "catalog/pg_subscription.h"
 #include "catalog/pg_ts_config.h"
diff --git a/src/backend/commands/lockcmds.c b/src/backend/commands/lockcmds.c
index f66b8f17b9b..5a52f4acace 100644
--- a/src/backend/commands/lockcmds.c
+++ b/src/backend/commands/lockcmds.c
@@ -17,6 +17,7 @@
 #include "access/table.h"
 #include "access/xact.h"
 #include "catalog/namespace.h"
+#include "catalog/objectaddress.h"
 #include "catalog/pg_inherits.h"
 #include "commands/lockcmds.h"
 #include "miscadmin.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ce2e81f9c2..aa6c0977ba2 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -48,6 +48,7 @@
 #include "catalog/pg_opclass.h"
 #include "catalog/pg_policy.h"
 #include "catalog/pg_proc.h"
+#include "catalog/pg_publication.h"
 #include "catalog/pg_publication_rel.h"
 #include "catalog/pg_rewrite.h"
 #include "catalog/pg_statistic_ext.h"
diff --git a/contrib/pg_surgery/heap_surgery.c b/contrib/pg_surgery/heap_surgery.c
index ae4e7c0136c..b69505c1488 100644
--- a/contrib/pg_surgery/heap_surgery.c
+++ b/contrib/pg_surgery/heap_surgery.c
@@ -16,6 +16,7 @@
 #include "access/relation.h"
 #include "access/visibilitymap.h"
 #include "access/xloginsert.h"
+#include "catalog/objectaddress.h"
 #include "catalog/pg_am_d.h"
 #include "miscadmin.h"
 #include "storage/bufmgr.h"
diff --git a/contrib/pgrowlocks/pgrowlocks.c b/contrib/pgrowlocks/pgrowlocks.c
index d164c4c03ad..077ce61dd71 100644
--- a/contrib/pgrowlocks/pgrowlocks.c
+++ b/contrib/pgrowlocks/pgrowlocks.c
@@ -30,6 +30,7 @@
 #include "access/tableam.h"
 #include "access/xact.h"
 #include "catalog/namespace.h"
+#include "catalog/objectaddress.h"
 #include "catalog/pg_am_d.h"
 #include "catalog/pg_authid.h"
 #include "funcapi.h"
-- 
2.53.0.1.gb2826b52eb

