From 20d281f294fec26aa962c38f777dd1e8e36cb53e Mon Sep 17 00:00:00 2001
From: Amit Kapila <akapila@postgresql.org>
Date: Mon, 16 Feb 2026 09:29:23 +0530
Subject: [PATCH v1] fix header inclusion.

---
 src/backend/commands/functioncmds.c                   |  1 +
 src/backend/storage/ipc/procsignal.c                  |  1 +
 src/backend/utils/activity/pgstat_subscription.c      |  2 +-
 src/include/pgstat.h                                  |  2 +-
 src/include/replication/logicalworker.h               | 10 ++++++++++
 src/include/replication/worker_internal.h             | 11 +----------
 .../modules/test_custom_stats/test_custom_var_stats.c |  1 +
 7 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index a516b037dea..bcac267b78c 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -32,6 +32,7 @@
  */
 #include "postgres.h"
 
+#include "access/xact.h"
 #include "access/htup_details.h"
 #include "access/table.h"
 #include "catalog/catalog.h"
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index 5d33559926a..7505c9d3a37 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -22,6 +22,7 @@
 #include "miscadmin.h"
 #include "pgstat.h"
 #include "port/pg_bitutils.h"
+#include "replication/logicalctl.h"
 #include "replication/logicalworker.h"
 #include "replication/walsender.h"
 #include "storage/condition_variable.h"
diff --git a/src/backend/utils/activity/pgstat_subscription.c b/src/backend/utils/activity/pgstat_subscription.c
index 500b1899188..8e97ef4c6e1 100644
--- a/src/backend/utils/activity/pgstat_subscription.c
+++ b/src/backend/utils/activity/pgstat_subscription.c
@@ -17,7 +17,7 @@
 
 #include "postgres.h"
 
-#include "replication/worker_internal.h"
+#include "replication/logicalworker.h"
 #include "utils/pgstat_internal.h"
 
 
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index fff7ecc2533..1af49ed144d 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -16,7 +16,7 @@
 #include "portability/instr_time.h"
 #include "postmaster/pgarch.h"	/* for MAX_XFN_CHARS */
 #include "replication/conflict.h"
-#include "replication/worker_internal.h"
+#include "replication/logicalworker.h"
 #include "utils/backend_progress.h" /* for backward compatibility */	/* IWYU pragma: export */
 #include "utils/backend_status.h"	/* for backward compatibility */	/* IWYU pragma: export */
 #include "utils/pgstat_kind.h"
diff --git a/src/include/replication/logicalworker.h b/src/include/replication/logicalworker.h
index 7d748a28da8..822349f5126 100644
--- a/src/include/replication/logicalworker.h
+++ b/src/include/replication/logicalworker.h
@@ -16,6 +16,16 @@
 
 extern PGDLLIMPORT volatile sig_atomic_t ParallelApplyMessagePending;
 
+/* Different types of worker */
+typedef enum LogicalRepWorkerType
+{
+	WORKERTYPE_UNKNOWN = 0,
+	WORKERTYPE_TABLESYNC,
+	WORKERTYPE_SEQUENCESYNC,
+	WORKERTYPE_APPLY,
+	WORKERTYPE_PARALLEL_APPLY,
+} LogicalRepWorkerType;
+
 extern void ApplyWorkerMain(Datum main_arg);
 extern void ParallelApplyWorkerMain(Datum main_arg);
 extern void TableSyncWorkerMain(Datum main_arg);
diff --git a/src/include/replication/worker_internal.h b/src/include/replication/worker_internal.h
index c1285fdd1bc..9c22b4ba467 100644
--- a/src/include/replication/worker_internal.h
+++ b/src/include/replication/worker_internal.h
@@ -17,6 +17,7 @@
 #include "datatype/timestamp.h"
 #include "miscadmin.h"
 #include "replication/logicalrelation.h"
+#include "replication/logicalworker.h"
 #include "replication/walreceiver.h"
 #include "storage/buffile.h"
 #include "storage/fileset.h"
@@ -25,16 +26,6 @@
 #include "storage/shm_toc.h"
 #include "storage/spin.h"
 
-/* Different types of worker */
-typedef enum LogicalRepWorkerType
-{
-	WORKERTYPE_UNKNOWN = 0,
-	WORKERTYPE_TABLESYNC,
-	WORKERTYPE_SEQUENCESYNC,
-	WORKERTYPE_APPLY,
-	WORKERTYPE_PARALLEL_APPLY,
-} LogicalRepWorkerType;
-
 typedef struct LogicalRepWorker
 {
 	/* What type of worker is this? */
diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c
index 64a8fe63cce..da28afbd929 100644
--- a/src/test/modules/test_custom_stats/test_custom_var_stats.c
+++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c
@@ -12,6 +12,7 @@
  */
 #include "postgres.h"
 
+#include "access/htup_details.h"
 #include "common/hashfn.h"
 #include "funcapi.h"
 #include "storage/dsm_registry.h"
-- 
2.52.0

