From 1be86af11472243fdc14d5d5460505ade1034426 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81lvaro=20Herrera?= <alvherre@kurilemu.de>
Date: Tue, 30 Sep 2025 16:16:04 +0200
Subject: [PATCH 2/2] Don't include access/htup_details.h in
 executor/tuptable.h

This is not at all needed; I suspect it was a simple mistake in commit
5408e233f066.  It causes htup_details.h to bleed into a huge number of
places via execnodes.h.  Remove it and fix fallout.
---
 contrib/pageinspect/btreefuncs.c                          | 1 +
 contrib/pageinspect/gistfuncs.c                           | 1 +
 contrib/pg_stat_statements/pg_stat_statements.c           | 1 +
 contrib/pg_walinspect/pg_walinspect.c                     | 1 +
 contrib/postgres_fdw/connection.c                         | 1 +
 contrib/xml2/xslt_proc.c                                  | 1 +
 src/backend/access/common/printsimple.c                   | 1 +
 src/backend/access/common/printtup.c                      | 1 +
 src/backend/access/common/tupconvert.c                    | 1 +
 src/backend/backup/walsummaryfuncs.c                      | 1 +
 src/backend/catalog/pg_attrdef.c                          | 1 +
 src/backend/catalog/pg_largeobject.c                      | 1 +
 src/backend/catalog/pg_parameter_acl.c                    | 1 +
 src/backend/commands/explain_dr.c                         | 1 +
 src/backend/commands/proclang.c                           | 1 +
 src/backend/commands/statscmds.c                          | 1 +
 src/backend/executor/nodeGatherMerge.c                    | 1 +
 src/backend/executor/nodeMemoize.c                        | 1 +
 src/backend/executor/tstoreReceiver.c                     | 1 +
 src/backend/optimizer/path/indxpath.c                     | 1 +
 src/backend/optimizer/util/pathnode.c                     | 1 +
 src/backend/parser/parse_coerce.c                         | 1 +
 src/backend/parser/parse_expr.c                           | 1 +
 src/backend/utils/adt/arrayfuncs.c                        | 1 +
 src/backend/utils/adt/hbafuncs.c                          | 1 +
 src/backend/utils/adt/json.c                              | 1 +
 src/backend/utils/adt/misc.c                              | 1 +
 src/backend/utils/adt/rangetypes.c                        | 1 +
 src/backend/utils/adt/xid8funcs.c                         | 1 +
 src/backend/utils/fmgr/fmgr.c                             | 1 +
 src/backend/utils/misc/guc.c                              | 1 +
 src/include/access/gin_private.h                          | 1 +
 src/include/executor/tuptable.h                           | 1 -
 src/test/modules/injection_points/injection_stats_fixed.c | 1 +
 34 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/contrib/pageinspect/btreefuncs.c b/contrib/pageinspect/btreefuncs.c
index 4e2e8891cdd..2e67c9adf5a 100644
--- a/contrib/pageinspect/btreefuncs.c
+++ b/contrib/pageinspect/btreefuncs.c
@@ -27,6 +27,7 @@
 
 #include "postgres.h"
 
+#include "access/htup_details.h"
 #include "access/nbtree.h"
 #include "access/relation.h"
 #include "catalog/namespace.h"
diff --git a/contrib/pageinspect/gistfuncs.c b/contrib/pageinspect/gistfuncs.c
index fab6e8d35ad..190353ec354 100644
--- a/contrib/pageinspect/gistfuncs.c
+++ b/contrib/pageinspect/gistfuncs.c
@@ -12,6 +12,7 @@
 #include "access/genam.h"
 #include "access/gist.h"
 #include "access/htup.h"
+#include "access/htup_details.h"
 #include "access/relation.h"
 #include "catalog/pg_am_d.h"
 #include "funcapi.h"
diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c
index 0bb0f933399..db1af36a705 100644
--- a/contrib/pg_stat_statements/pg_stat_statements.c
+++ b/contrib/pg_stat_statements/pg_stat_statements.c
@@ -47,6 +47,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
+#include "access/htup_details.h"
 #include "access/parallel.h"
 #include "catalog/pg_authid.h"
 #include "common/int.h"
diff --git a/contrib/pg_walinspect/pg_walinspect.c b/contrib/pg_walinspect/pg_walinspect.c
index 0398ad82cec..501cea8fc1a 100644
--- a/contrib/pg_walinspect/pg_walinspect.c
+++ b/contrib/pg_walinspect/pg_walinspect.c
@@ -12,6 +12,7 @@
  */
 #include "postgres.h"
 
+#include "access/htup_details.h"
 #include "access/xlog.h"
 #include "access/xlog_internal.h"
 #include "access/xlogreader.h"
diff --git a/contrib/postgres_fdw/connection.c b/contrib/postgres_fdw/connection.c
index 4fbb6c182b8..953c2e0ab82 100644
--- a/contrib/postgres_fdw/connection.c
+++ b/contrib/postgres_fdw/connection.c
@@ -16,6 +16,7 @@
 #include <poll.h>
 #endif
 
+#include "access/htup_details.h"
 #include "access/xact.h"
 #include "catalog/pg_user_mapping.h"
 #include "commands/defrem.h"
diff --git a/contrib/xml2/xslt_proc.c b/contrib/xml2/xslt_proc.c
index 53550c7dc24..36578b82e4d 100644
--- a/contrib/xml2/xslt_proc.c
+++ b/contrib/xml2/xslt_proc.c
@@ -10,6 +10,7 @@
 #include "fmgr.h"
 #include "utils/builtins.h"
 #include "utils/xml.h"
+#include "varatt.h"
 
 #ifdef USE_LIBXSLT
 
diff --git a/src/backend/access/common/printsimple.c b/src/backend/access/common/printsimple.c
index a09c8fcd332..756f1c4822d 100644
--- a/src/backend/access/common/printsimple.c
+++ b/src/backend/access/common/printsimple.c
@@ -23,6 +23,7 @@
 #include "libpq/pqformat.h"
 #include "libpq/protocol.h"
 #include "utils/builtins.h"
+#include "varatt.h"
 
 /*
  * At startup time, send a RowDescription message.
diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c
index 6d3045e2332..9f05e1d15bd 100644
--- a/src/backend/access/common/printtup.c
+++ b/src/backend/access/common/printtup.c
@@ -22,6 +22,7 @@
 #include "utils/lsyscache.h"
 #include "utils/memdebug.h"
 #include "utils/memutils.h"
+#include "varatt.h"
 
 
 static void printtup_startup(DestReceiver *self, int operation,
diff --git a/src/backend/access/common/tupconvert.c b/src/backend/access/common/tupconvert.c
index 54dc2f4ab80..1df0c2d2f98 100644
--- a/src/backend/access/common/tupconvert.c
+++ b/src/backend/access/common/tupconvert.c
@@ -18,6 +18,7 @@
  */
 #include "postgres.h"
 
+#include "access/htup_details.h"
 #include "access/tupconvert.h"
 #include "executor/tuptable.h"
 
diff --git a/src/backend/backup/walsummaryfuncs.c b/src/backend/backup/walsummaryfuncs.c
index d6dd131da14..29e2cb83ff4 100644
--- a/src/backend/backup/walsummaryfuncs.c
+++ b/src/backend/backup/walsummaryfuncs.c
@@ -12,6 +12,7 @@
 
 #include "postgres.h"
 
+#include "access/htup_details.h"
 #include "backup/walsummary.h"
 #include "common/blkreftable.h"
 #include "funcapi.h"
diff --git a/src/backend/catalog/pg_attrdef.c b/src/backend/catalog/pg_attrdef.c
index 4db4ffd657c..e8bdb52cb00 100644
--- a/src/backend/catalog/pg_attrdef.c
+++ b/src/backend/catalog/pg_attrdef.c
@@ -15,6 +15,7 @@
 #include "postgres.h"
 
 #include "access/genam.h"
+#include "access/htup_details.h"
 #include "access/relation.h"
 #include "access/table.h"
 #include "catalog/dependency.h"
diff --git a/src/backend/catalog/pg_largeobject.c b/src/backend/catalog/pg_largeobject.c
index 471f82f51a8..ada4c3685e0 100644
--- a/src/backend/catalog/pg_largeobject.c
+++ b/src/backend/catalog/pg_largeobject.c
@@ -15,6 +15,7 @@
 #include "postgres.h"
 
 #include "access/genam.h"
+#include "access/htup_details.h"
 #include "access/table.h"
 #include "catalog/catalog.h"
 #include "catalog/indexing.h"
diff --git a/src/backend/catalog/pg_parameter_acl.c b/src/backend/catalog/pg_parameter_acl.c
index 62a05783eb3..dcdf49ea408 100644
--- a/src/backend/catalog/pg_parameter_acl.c
+++ b/src/backend/catalog/pg_parameter_acl.c
@@ -14,6 +14,7 @@
  */
 #include "postgres.h"
 
+#include "access/htup_details.h"
 #include "access/table.h"
 #include "catalog/catalog.h"
 #include "catalog/indexing.h"
diff --git a/src/backend/commands/explain_dr.c b/src/backend/commands/explain_dr.c
index d6084077be7..95685d7e88d 100644
--- a/src/backend/commands/explain_dr.c
+++ b/src/backend/commands/explain_dr.c
@@ -19,6 +19,7 @@
 #include "libpq/pqformat.h"
 #include "libpq/protocol.h"
 #include "utils/lsyscache.h"
+#include "varatt.h"
 
 /*
  * DestReceiver functions for SERIALIZE option
diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c
index 5036ac03639..d75e2fa74b2 100644
--- a/src/backend/commands/proclang.c
+++ b/src/backend/commands/proclang.c
@@ -13,6 +13,7 @@
  */
 #include "postgres.h"
 
+#include "access/htup_details.h"
 #include "access/table.h"
 #include "catalog/catalog.h"
 #include "catalog/dependency.h"
diff --git a/src/backend/commands/statscmds.c b/src/backend/commands/statscmds.c
index e24d540cd45..27bf67e7c4b 100644
--- a/src/backend/commands/statscmds.c
+++ b/src/backend/commands/statscmds.c
@@ -14,6 +14,7 @@
  */
 #include "postgres.h"
 
+#include "access/htup_details.h"
 #include "access/relation.h"
 #include "access/table.h"
 #include "catalog/catalog.h"
diff --git a/src/backend/executor/nodeGatherMerge.c b/src/backend/executor/nodeGatherMerge.c
index 15f84597067..93f3dbc6cf4 100644
--- a/src/backend/executor/nodeGatherMerge.c
+++ b/src/backend/executor/nodeGatherMerge.c
@@ -14,6 +14,7 @@
 
 #include "postgres.h"
 
+#include "access/htup_details.h"
 #include "executor/executor.h"
 #include "executor/execParallel.h"
 #include "executor/nodeGatherMerge.h"
diff --git a/src/backend/executor/nodeMemoize.c b/src/backend/executor/nodeMemoize.c
index 609deb12afb..d652663cb6a 100644
--- a/src/backend/executor/nodeMemoize.c
+++ b/src/backend/executor/nodeMemoize.c
@@ -66,6 +66,7 @@
 
 #include "postgres.h"
 
+#include "access/htup_details.h"
 #include "common/hashfn.h"
 #include "executor/executor.h"
 #include "executor/nodeMemoize.h"
diff --git a/src/backend/executor/tstoreReceiver.c b/src/backend/executor/tstoreReceiver.c
index 562de676457..02a3ad3aa68 100644
--- a/src/backend/executor/tstoreReceiver.c
+++ b/src/backend/executor/tstoreReceiver.c
@@ -25,6 +25,7 @@
 #include "access/detoast.h"
 #include "access/tupconvert.h"
 #include "executor/tstoreReceiver.h"
+#include "varatt.h"
 
 
 typedef struct
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index 3a3f55a236d..edc6d2ac1d3 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -19,6 +19,7 @@
 
 #include "access/stratnum.h"
 #include "access/sysattr.h"
+#include "access/transam.h"
 #include "catalog/pg_am.h"
 #include "catalog/pg_amop.h"
 #include "catalog/pg_operator.h"
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index b0da28150d3..bca51b4067b 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -16,6 +16,7 @@
 
 #include <math.h>
 
+#include "access/htup_details.h"
 #include "foreign/fdwapi.h"
 #include "miscadmin.h"
 #include "nodes/extensible.h"
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index 0b5b81c7f27..78b1e366ad7 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -14,6 +14,7 @@
  */
 #include "postgres.h"
 
+#include "access/htup_details.h"
 #include "catalog/pg_cast.h"
 #include "catalog/pg_class.h"
 #include "catalog/pg_inherits.h"
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index eebea694dda..72625a94dcc 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -15,6 +15,7 @@
 
 #include "postgres.h"
 
+#include "access/htup_details.h"
 #include "catalog/pg_aggregate.h"
 #include "catalog/pg_type.h"
 #include "miscadmin.h"
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index e5f3e2da35c..a8951f55b93 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -17,6 +17,7 @@
 #include <ctype.h>
 #include <math.h>
 
+#include "access/transam.h"
 #include "catalog/pg_type.h"
 #include "common/int.h"
 #include "funcapi.h"
diff --git a/src/backend/utils/adt/hbafuncs.c b/src/backend/utils/adt/hbafuncs.c
index b62c3d944cf..1614d6d2302 100644
--- a/src/backend/utils/adt/hbafuncs.c
+++ b/src/backend/utils/adt/hbafuncs.c
@@ -14,6 +14,7 @@
  */
 #include "postgres.h"
 
+#include "access/htup_details.h"
 #include "catalog/objectaddress.h"
 #include "common/ip.h"
 #include "funcapi.h"
diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c
index e9d370cb3da..14f5cb498fc 100644
--- a/src/backend/utils/adt/json.c
+++ b/src/backend/utils/adt/json.c
@@ -13,6 +13,7 @@
  */
 #include "postgres.h"
 
+#include "access/htup_details.h"
 #include "catalog/pg_proc.h"
 #include "catalog/pg_type.h"
 #include "common/hashfn.h"
diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c
index 2c5a7ee9ddc..7cb7716e58b 100644
--- a/src/backend/utils/adt/misc.c
+++ b/src/backend/utils/adt/misc.c
@@ -21,6 +21,7 @@
 #include <math.h>
 #include <unistd.h>
 
+#include "access/htup_details.h"
 #include "access/sysattr.h"
 #include "access/table.h"
 #include "catalog/pg_tablespace.h"
diff --git a/src/backend/utils/adt/rangetypes.c b/src/backend/utils/adt/rangetypes.c
index 18e467bccd3..0b2ad8b0975 100644
--- a/src/backend/utils/adt/rangetypes.c
+++ b/src/backend/utils/adt/rangetypes.c
@@ -45,6 +45,7 @@
 #include "utils/rangetypes.h"
 #include "utils/sortsupport.h"
 #include "utils/timestamp.h"
+#include "varatt.h"
 
 
 /* fn_extra cache entry for one of the range I/O functions */
diff --git a/src/backend/utils/adt/xid8funcs.c b/src/backend/utils/adt/xid8funcs.c
index 1da3964ca6f..a211a107767 100644
--- a/src/backend/utils/adt/xid8funcs.c
+++ b/src/backend/utils/adt/xid8funcs.c
@@ -39,6 +39,7 @@
 #include "utils/memutils.h"
 #include "utils/snapmgr.h"
 #include "utils/xid8.h"
+#include "varatt.h"
 
 
 /*
diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c
index b4c1e2c4b21..0fe63c6bb83 100644
--- a/src/backend/utils/fmgr/fmgr.c
+++ b/src/backend/utils/fmgr/fmgr.c
@@ -16,6 +16,7 @@
 #include "postgres.h"
 
 #include "access/detoast.h"
+#include "access/htup_details.h"
 #include "catalog/pg_language.h"
 #include "catalog/pg_proc.h"
 #include "catalog/pg_type.h"
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 46fdefebe35..107b5a273a2 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -34,6 +34,7 @@
 #include "catalog/objectaccess.h"
 #include "catalog/pg_authid.h"
 #include "catalog/pg_parameter_acl.h"
+#include "catalog/pg_type.h"
 #include "guc_internal.h"
 #include "libpq/pqformat.h"
 #include "libpq/protocol.h"
diff --git a/src/include/access/gin_private.h b/src/include/access/gin_private.h
index aee1f70c22e..9ea303a7c1b 100644
--- a/src/include/access/gin_private.h
+++ b/src/include/access/gin_private.h
@@ -13,6 +13,7 @@
 #include "access/amapi.h"
 #include "access/gin.h"
 #include "access/ginblock.h"
+#include "access/htup_details.h"
 #include "access/itup.h"
 #include "common/int.h"
 #include "catalog/pg_am_d.h"
diff --git a/src/include/executor/tuptable.h b/src/include/executor/tuptable.h
index 095e4cc82e3..43f1d999b91 100644
--- a/src/include/executor/tuptable.h
+++ b/src/include/executor/tuptable.h
@@ -15,7 +15,6 @@
 #define TUPTABLE_H
 
 #include "access/htup.h"
-#include "access/htup_details.h"
 #include "access/sysattr.h"
 #include "access/tupdesc.h"
 #include "storage/buf.h"
diff --git a/src/test/modules/injection_points/injection_stats_fixed.c b/src/test/modules/injection_points/injection_stats_fixed.c
index 74c35fcbfa7..b493e8f77a3 100644
--- a/src/test/modules/injection_points/injection_stats_fixed.c
+++ b/src/test/modules/injection_points/injection_stats_fixed.c
@@ -16,6 +16,7 @@
 
 #include "fmgr.h"
 
+#include "access/htup_details.h"
 #include "common/hashfn.h"
 #include "funcapi.h"
 #include "injection_stats.h"
-- 
2.47.3

