From: Álvaro Herrera Date: Mon, 16 Mar 2026 13:34:57 +0000 (+0100) Subject: Reduce header inclusions via execnodes.h X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fba4233c832870c8363438419743c48fdcb2151c;p=thirdparty%2Fpostgresql.git Reduce header inclusions via execnodes.h Remove a bunch of #include lines from execnodes.h. Most of these requier suitable typedefs to be added, so that it still compiles standalone. In one case, the fix is to move a struct definition to the one .c file where it is needed. Also some light clean up in plannodes.h and genam.h, though not as extensive as in execnodes.h. Author: Álvaro Herrera Author: Andres Freund Discussion: https://postgr.es/m/202603131240.ihwqdxnj7w2o@alvherre.pgsql --- diff --git a/contrib/amcheck/verify_heapam.c b/contrib/amcheck/verify_heapam.c index 31e19fbc697..ada782f98f5 100644 --- a/contrib/amcheck/verify_heapam.c +++ b/contrib/amcheck/verify_heapam.c @@ -29,6 +29,7 @@ #include "utils/builtins.h" #include "utils/fmgroids.h" #include "utils/rel.h" +#include "utils/tuplestore.h" PG_FUNCTION_INFO_V1(verify_heapam); diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c index 4038950a6ef..ac6127ec1b5 100644 --- a/contrib/dblink/dblink.c +++ b/contrib/dblink/dblink.c @@ -62,6 +62,7 @@ #include "utils/lsyscache.h" #include "utils/memutils.h" #include "utils/rel.h" +#include "utils/tuplestore.h" #include "utils/varlena.h" #include "utils/wait_event.h" diff --git a/contrib/hstore/hstore_subs.c b/contrib/hstore/hstore_subs.c index 45b8c962038..56e0858c1a6 100644 --- a/contrib/hstore/hstore_subs.c +++ b/contrib/hstore/hstore_subs.c @@ -23,6 +23,7 @@ */ #include "postgres.h" +#include "catalog/pg_type_d.h" #include "executor/execExpr.h" #include "hstore.h" #include "nodes/nodeFuncs.h" diff --git a/contrib/pageinspect/brinfuncs.c b/contrib/pageinspect/brinfuncs.c index 26cf78252ed..309b9522f90 100644 --- a/contrib/pageinspect/brinfuncs.c +++ b/contrib/pageinspect/brinfuncs.c @@ -22,6 +22,7 @@ #include "utils/builtins.h" #include "utils/lsyscache.h" #include "utils/rel.h" +#include "utils/tuplestore.h" PG_FUNCTION_INFO_V1(brin_page_type); PG_FUNCTION_INFO_V1(brin_page_items); diff --git a/contrib/pageinspect/gistfuncs.c b/contrib/pageinspect/gistfuncs.c index a205cb8a334..e56c7d8a601 100644 --- a/contrib/pageinspect/gistfuncs.c +++ b/contrib/pageinspect/gistfuncs.c @@ -25,6 +25,7 @@ #include "utils/pg_lsn.h" #include "utils/rel.h" #include "utils/ruleutils.h" +#include "utils/tuplestore.h" PG_FUNCTION_INFO_V1(gist_page_opaque_info); PG_FUNCTION_INFO_V1(gist_page_items); diff --git a/contrib/pg_buffercache/pg_buffercache_pages.c b/contrib/pg_buffercache/pg_buffercache_pages.c index a6b4fb5252b..db4d711cce7 100644 --- a/contrib/pg_buffercache/pg_buffercache_pages.c +++ b/contrib/pg_buffercache/pg_buffercache_pages.c @@ -16,6 +16,7 @@ #include "storage/buf_internals.h" #include "storage/bufmgr.h" #include "utils/rel.h" +#include "utils/tuplestore.h" #define NUM_BUFFERCACHE_PAGES_MIN_ELEM 8 diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c index 4a427533bd8..6cb14824ec3 100644 --- a/contrib/pg_stat_statements/pg_stat_statements.c +++ b/contrib/pg_stat_statements/pg_stat_statements.c @@ -71,6 +71,7 @@ #include "utils/builtins.h" #include "utils/memutils.h" #include "utils/timestamp.h" +#include "utils/tuplestore.h" PG_MODULE_MAGIC_EXT( .name = "pg_stat_statements", diff --git a/contrib/pg_walinspect/pg_walinspect.c b/contrib/pg_walinspect/pg_walinspect.c index 716a0922c6b..f6f5f0792d2 100644 --- a/contrib/pg_walinspect/pg_walinspect.c +++ b/contrib/pg_walinspect/pg_walinspect.c @@ -21,9 +21,11 @@ #include "access/xlogutils.h" #include "funcapi.h" #include "miscadmin.h" +#include "port/pg_bitutils.h" #include "utils/array.h" #include "utils/builtins.h" #include "utils/pg_lsn.h" +#include "utils/tuplestore.h" /* * NOTE: For any code change or issue fix here, it is highly recommended to diff --git a/contrib/pgrowlocks/pgrowlocks.c b/contrib/pgrowlocks/pgrowlocks.c index f88269332b6..ff3692c87c4 100644 --- a/contrib/pgrowlocks/pgrowlocks.c +++ b/contrib/pgrowlocks/pgrowlocks.c @@ -40,6 +40,7 @@ #include "utils/fmgrprotos.h" #include "utils/rel.h" #include "utils/snapmgr.h" +#include "utils/tuplestore.h" #include "utils/varlena.h" PG_MODULE_MAGIC_EXT( diff --git a/contrib/postgres_fdw/connection.c b/contrib/postgres_fdw/connection.c index 7e2b822d161..192f8011160 100644 --- a/contrib/postgres_fdw/connection.c +++ b/contrib/postgres_fdw/connection.c @@ -33,6 +33,7 @@ #include "utils/hsearch.h" #include "utils/inval.h" #include "utils/syscache.h" +#include "utils/tuplestore.h" /* * Connection cache hash table entry diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index 60d90329a65..41e47cc795b 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -22,6 +22,7 @@ #include "commands/explain_format.h" #include "commands/explain_state.h" #include "executor/execAsync.h" +#include "executor/instrument.h" #include "foreign/fdwapi.h" #include "funcapi.h" #include "miscadmin.h" diff --git a/contrib/tablefunc/tablefunc.c b/contrib/tablefunc/tablefunc.c index ca2434c6e19..c01a01c5fe7 100644 --- a/contrib/tablefunc/tablefunc.c +++ b/contrib/tablefunc/tablefunc.c @@ -43,6 +43,7 @@ #include "lib/stringinfo.h" #include "miscadmin.h" #include "utils/builtins.h" +#include "utils/tuplestore.h" PG_MODULE_MAGIC_EXT( .name = "tablefunc", diff --git a/contrib/tsm_system_time/tsm_system_time.c b/contrib/tsm_system_time/tsm_system_time.c index 4b22eeae9a4..4814c31bc6f 100644 --- a/contrib/tsm_system_time/tsm_system_time.c +++ b/contrib/tsm_system_time/tsm_system_time.c @@ -30,6 +30,7 @@ #include "catalog/pg_type.h" #include "miscadmin.h" #include "optimizer/optimizer.h" +#include "portability/instr_time.h" #include "utils/sampling.h" #include "utils/spccache.h" diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c index 662d7d02f27..14b9e014d74 100644 --- a/contrib/xml2/xpath.c +++ b/contrib/xml2/xpath.c @@ -12,6 +12,7 @@ #include "funcapi.h" #include "lib/stringinfo.h" #include "utils/builtins.h" +#include "utils/tuplestore.h" #include "utils/xml.h" /* libxml includes */ diff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.c index 1909c3254b5..2a0f8c8e3b8 100644 --- a/src/backend/access/brin/brin.c +++ b/src/backend/access/brin/brin.c @@ -28,10 +28,12 @@ #include "catalog/index.h" #include "catalog/pg_am.h" #include "commands/vacuum.h" +#include "executor/instrument.h" #include "miscadmin.h" #include "pgstat.h" #include "postmaster/autovacuum.h" #include "storage/bufmgr.h" +#include "storage/condition_variable.h" #include "storage/freespace.h" #include "storage/proc.h" #include "tcop/tcopprot.h" diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c index 97cea5f7d4e..e54782d9dd8 100644 --- a/src/backend/access/gin/gininsert.c +++ b/src/backend/access/gin/gininsert.c @@ -23,10 +23,12 @@ #include "catalog/index.h" #include "catalog/pg_collation.h" #include "commands/progress.h" +#include "executor/instrument.h" #include "miscadmin.h" #include "nodes/execnodes.h" #include "pgstat.h" #include "storage/bufmgr.h" +#include "storage/condition_variable.h" #include "storage/proc.h" #include "storage/predicate.h" #include "tcop/tcopprot.h" @@ -34,6 +36,7 @@ #include "utils/memutils.h" #include "utils/builtins.h" #include "utils/rel.h" +#include "utils/tuplesort.h" #include "utils/typcache.h" #include "utils/wait_event.h" diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c index 42bf73d3138..253a735b6c1 100644 --- a/src/backend/access/heap/heapam_handler.c +++ b/src/backend/access/heap/heapam_handler.c @@ -45,6 +45,7 @@ #include "storage/smgr.h" #include "utils/builtins.h" #include "utils/rel.h" +#include "utils/tuplesort.h" static void reform_and_rewrite_tuple(HeapTuple tuple, Relation OldHeap, Relation NewHeap, diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c index 69ef1527e06..47a9bda30c9 100644 --- a/src/backend/access/nbtree/nbtsort.c +++ b/src/backend/access/nbtree/nbtsort.c @@ -52,6 +52,7 @@ #include "miscadmin.h" #include "pgstat.h" #include "storage/bulk_write.h" +#include "storage/condition_variable.h" #include "storage/proc.h" #include "tcop/tcopprot.h" #include "utils/rel.h" diff --git a/src/backend/access/transam/xlogprefetcher.c b/src/backend/access/transam/xlogprefetcher.c index 24cfa96d737..c235eca7c51 100644 --- a/src/backend/access/transam/xlogprefetcher.c +++ b/src/backend/access/transam/xlogprefetcher.c @@ -36,12 +36,14 @@ #include "miscadmin.h" #include "port/atomics.h" #include "storage/bufmgr.h" +#include "storage/fd.h" #include "storage/shmem.h" #include "storage/smgr.h" #include "utils/fmgrprotos.h" #include "utils/guc_hooks.h" #include "utils/hsearch.h" #include "utils/timestamp.h" +#include "utils/tuplestore.h" /* * Every time we process this much WAL, we'll update the values in diff --git a/src/backend/backup/walsummaryfuncs.c b/src/backend/backup/walsummaryfuncs.c index eb26596cf0a..f83c1604263 100644 --- a/src/backend/backup/walsummaryfuncs.c +++ b/src/backend/backup/walsummaryfuncs.c @@ -20,6 +20,7 @@ #include "postmaster/walsummarizer.h" #include "utils/fmgrprotos.h" #include "utils/pg_lsn.h" +#include "utils/tuplestore.h" #define NUM_WS_ATTS 3 #define NUM_SUMMARY_ATTS 6 diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index 17118f2fe76..68a42de0889 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -35,6 +35,7 @@ #include "pg_getopt.h" #include "postmaster/postmaster.h" #include "storage/bufpage.h" +#include "storage/fd.h" #include "storage/ipc.h" #include "storage/proc.h" #include "utils/builtins.h" diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 0e93ababa87..8b3c60d91f9 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -24,6 +24,7 @@ #include #include "access/amapi.h" +#include "access/attmap.h" #include "access/heapam.h" #include "access/multixact.h" #include "access/relscan.h" diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 53adac9139b..eeed91be266 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -34,6 +34,7 @@ #include "commands/vacuum.h" #include "common/pg_prng.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "foreign/fdwapi.h" #include "miscadmin.h" #include "nodes/nodeFuncs.h" diff --git a/src/backend/commands/copyfrom.c b/src/backend/commands/copyfrom.c index 95f6cb416a9..7516b69d016 100644 --- a/src/backend/commands/copyfrom.c +++ b/src/backend/commands/copyfrom.c @@ -26,6 +26,7 @@ #include "access/heapam.h" #include "access/tableam.h" +#include "access/tupconvert.h" #include "access/xact.h" #include "catalog/namespace.h" #include "commands/copyapi.h" diff --git a/src/backend/commands/copyfromparse.c b/src/backend/commands/copyfromparse.c index 00ee4154b8b..ed184ed8e96 100644 --- a/src/backend/commands/copyfromparse.c +++ b/src/backend/commands/copyfromparse.c @@ -71,6 +71,7 @@ #include "mb/pg_wchar.h" #include "miscadmin.h" #include "pgstat.h" +#include "port/pg_bitutils.h" #include "port/pg_bswap.h" #include "port/simd.h" #include "utils/builtins.h" diff --git a/src/backend/commands/copyto.c b/src/backend/commands/copyto.c index d6ef7275a64..499ce9ad3db 100644 --- a/src/backend/commands/copyto.c +++ b/src/backend/commands/copyto.c @@ -20,6 +20,7 @@ #include "access/table.h" #include "access/tableam.h" +#include "access/tupconvert.h" #include "catalog/pg_inherits.h" #include "commands/copyapi.h" #include "commands/progress.h" diff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/event_trigger.c index ff1323c7b82..ace8eca1f98 100644 --- a/src/backend/commands/event_trigger.c +++ b/src/backend/commands/event_trigger.c @@ -57,6 +57,7 @@ #include "utils/rel.h" #include "utils/snapmgr.h" #include "utils/syscache.h" +#include "utils/tuplestore.h" typedef struct EventTriggerQueryState { diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 5f922c3f5c2..296ea8a1ed2 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -42,6 +42,7 @@ #include "utils/ruleutils.h" #include "utils/snapmgr.h" #include "utils/tuplesort.h" +#include "utils/tuplestore.h" #include "utils/typcache.h" #include "utils/xml.h" diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c index 963618a64c4..b98801d08f2 100644 --- a/src/backend/commands/extension.c +++ b/src/backend/commands/extension.c @@ -69,6 +69,7 @@ #include "utils/rel.h" #include "utils/snapmgr.h" #include "utils/syscache.h" +#include "utils/tuplestore.h" #include "utils/varlena.h" diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 635679cc1f2..cbd76066f74 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -16,6 +16,7 @@ #include "postgres.h" #include "access/amapi.h" +#include "access/attmap.h" #include "access/gist.h" #include "access/heapam.h" #include "access/htup_details.h" diff --git a/src/backend/commands/prepare.c b/src/backend/commands/prepare.c index 5b86a727587..876aad2100a 100644 --- a/src/backend/commands/prepare.c +++ b/src/backend/commands/prepare.c @@ -34,8 +34,10 @@ #include "tcop/pquery.h" #include "tcop/utility.h" #include "utils/builtins.h" +#include "utils/hsearch.h" #include "utils/snapmgr.h" #include "utils/timestamp.h" +#include "utils/tuplestore.h" /* diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8118f7aa1ef..dfdde986236 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -25,6 +25,7 @@ #include "access/sysattr.h" #include "access/tableam.h" #include "access/toast_compression.h" +#include "access/tupconvert.h" #include "access/xact.h" #include "access/xlog.h" #include "access/xloginsert.h" diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 98d402c0a3b..9c0438a125a 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -19,6 +19,7 @@ #include "access/sysattr.h" #include "access/table.h" #include "access/tableam.h" +#include "access/tupconvert.h" #include "access/xact.h" #include "catalog/catalog.h" #include "catalog/dependency.h" @@ -32,6 +33,7 @@ #include "catalog/pg_type.h" #include "commands/trigger.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "miscadmin.h" #include "nodes/bitmapset.h" #include "nodes/makefuncs.h" diff --git a/src/backend/commands/wait.c b/src/backend/commands/wait.c index 8e920a72372..e64e3be6285 100644 --- a/src/backend/commands/wait.c +++ b/src/backend/commands/wait.c @@ -18,6 +18,7 @@ #include "access/xlog.h" #include "access/xlogrecovery.h" #include "access/xlogwait.h" +#include "catalog/pg_type_d.h" #include "commands/defrem.h" #include "commands/wait.h" #include "executor/executor.h" diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c index 90a68c0d156..37fe03fdc37 100644 --- a/src/backend/executor/execAmi.c +++ b/src/backend/executor/execAmi.c @@ -16,6 +16,7 @@ #include "access/htup_details.h" #include "catalog/pg_class.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "executor/nodeAgg.h" #include "executor/nodeAppend.h" #include "executor/nodeBitmapAnd.h" diff --git a/src/backend/executor/execAsync.c b/src/backend/executor/execAsync.c index 8728111355d..cf7ddbb01f4 100644 --- a/src/backend/executor/execAsync.c +++ b/src/backend/executor/execAsync.c @@ -16,6 +16,7 @@ #include "executor/execAsync.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "executor/nodeAppend.h" #include "executor/nodeForeignscan.h" diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c index 61ff5ddc74c..98689649680 100644 --- a/src/backend/executor/execExprInterp.c +++ b/src/backend/executor/execExprInterp.c @@ -57,6 +57,7 @@ #include "postgres.h" #include "access/heaptoast.h" +#include "access/tupconvert.h" #include "catalog/pg_type.h" #include "commands/sequence.h" #include "executor/execExpr.h" @@ -77,6 +78,7 @@ #include "utils/lsyscache.h" #include "utils/memutils.h" #include "utils/timestamp.h" +#include "utils/tuplesort.h" #include "utils/typcache.h" #include "utils/xml.h" diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 4015aef1b1f..58b84955c2b 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -40,6 +40,7 @@ #include "access/sysattr.h" #include "access/table.h" #include "access/tableam.h" +#include "access/tupconvert.h" #include "access/xact.h" #include "catalog/namespace.h" #include "catalog/partition.h" @@ -47,6 +48,7 @@ #include "commands/trigger.h" #include "executor/executor.h" #include "executor/execPartition.h" +#include "executor/instrument.h" #include "executor/nodeSubplan.h" #include "foreign/fdwapi.h" #include "mb/pg_wchar.h" diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c index bab294f5e91..d96d4f9947b 100644 --- a/src/backend/executor/execPartition.c +++ b/src/backend/executor/execPartition.c @@ -15,6 +15,7 @@ #include "access/table.h" #include "access/tableam.h" +#include "access/tupconvert.h" #include "catalog/index.h" #include "catalog/partition.h" #include "executor/execPartition.h" diff --git a/src/backend/executor/execProcnode.c b/src/backend/executor/execProcnode.c index 7e40b852517..d35976925ae 100644 --- a/src/backend/executor/execProcnode.c +++ b/src/backend/executor/execProcnode.c @@ -73,6 +73,7 @@ #include "postgres.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "executor/nodeAgg.h" #include "executor/nodeAppend.h" #include "executor/nodeBitmapAnd.h" diff --git a/src/backend/executor/execSRF.c b/src/backend/executor/execSRF.c index b481e50acfb..8aedcc6a459 100644 --- a/src/backend/executor/execSRF.c +++ b/src/backend/executor/execSRF.c @@ -30,6 +30,7 @@ #include "utils/builtins.h" #include "utils/lsyscache.h" #include "utils/memutils.h" +#include "utils/tuplestore.h" #include "utils/typcache.h" diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c index c3b9c188de1..9886ab06b69 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -48,6 +48,7 @@ #include "access/parallel.h" #include "access/table.h" #include "access/tableam.h" +#include "access/tupconvert.h" #include "executor/executor.h" #include "executor/nodeModifyTable.h" #include "jit/jit.h" @@ -55,6 +56,7 @@ #include "miscadmin.h" #include "parser/parse_relation.h" #include "partitioning/partdesc.h" +#include "port/pg_bitutils.h" #include "storage/lmgr.h" #include "utils/builtins.h" #include "utils/memutils.h" diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index 4ca342a43ef..88109348817 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -37,6 +37,7 @@ #include "utils/plancache.h" #include "utils/snapmgr.h" #include "utils/syscache.h" +#include "utils/tuplestore.h" /* diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index e248213c090..925caadd2ce 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -257,6 +257,7 @@ #include "common/hashfn.h" #include "executor/execExpr.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "executor/nodeAgg.h" #include "lib/hyperloglog.h" #include "miscadmin.h" @@ -264,6 +265,7 @@ #include "optimizer/optimizer.h" #include "parser/parse_agg.h" #include "parser/parse_coerce.h" +#include "port/pg_bitutils.h" #include "utils/acl.h" #include "utils/builtins.h" #include "utils/datum.h" diff --git a/src/backend/executor/nodeBitmapAnd.c b/src/backend/executor/nodeBitmapAnd.c index e6406c8f92b..9007dda3802 100644 --- a/src/backend/executor/nodeBitmapAnd.c +++ b/src/backend/executor/nodeBitmapAnd.c @@ -29,7 +29,9 @@ #include "postgres.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "executor/nodeBitmapAnd.h" +#include "nodes/tidbitmap.h" /* ---------------------------------------------------------------- diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c index e581a4c3b32..7cf8d23c742 100644 --- a/src/backend/executor/nodeBitmapHeapscan.c +++ b/src/backend/executor/nodeBitmapHeapscan.c @@ -39,10 +39,13 @@ #include "access/tableam.h" #include "access/visibilitymap.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "executor/nodeBitmapHeapscan.h" #include "miscadmin.h" #include "pgstat.h" #include "storage/bufmgr.h" +#include "storage/condition_variable.h" +#include "utils/dsa.h" #include "utils/rel.h" #include "utils/spccache.h" #include "utils/wait_event.h" @@ -53,6 +56,43 @@ static inline void BitmapDoneInitializingSharedState(ParallelBitmapHeapState *ps static bool BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate); +/* ---------------- + * SharedBitmapState information + * + * BM_INITIAL TIDBitmap creation is not yet started, so first worker + * to see this state will set the state to BM_INPROGRESS + * and that process will be responsible for creating + * TIDBitmap. + * BM_INPROGRESS TIDBitmap creation is in progress; workers need to + * sleep until it's finished. + * BM_FINISHED TIDBitmap creation is done, so now all workers can + * proceed to iterate over TIDBitmap. + * ---------------- + */ +typedef enum +{ + BM_INITIAL, + BM_INPROGRESS, + BM_FINISHED, +} SharedBitmapState; + +/* ---------------- + * ParallelBitmapHeapState information + * tbmiterator iterator for scanning current pages + * mutex mutual exclusion for state + * state current state of the TIDBitmap + * cv conditional wait variable + * ---------------- + */ +typedef struct ParallelBitmapHeapState +{ + dsa_pointer tbmiterator; + slock_t mutex; + SharedBitmapState state; + ConditionVariable cv; +} ParallelBitmapHeapState; + + /* * Do the underlying index scan, build the bitmap, set up the parallel state * needed for parallel workers to iterate through the bitmap, and set up the diff --git a/src/backend/executor/nodeBitmapIndexscan.c b/src/backend/executor/nodeBitmapIndexscan.c index e08b1c43ace..e6f378c05da 100644 --- a/src/backend/executor/nodeBitmapIndexscan.c +++ b/src/backend/executor/nodeBitmapIndexscan.c @@ -23,9 +23,11 @@ #include "access/genam.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "executor/nodeBitmapIndexscan.h" #include "executor/nodeIndexscan.h" #include "miscadmin.h" +#include "nodes/tidbitmap.h" /* ---------------------------------------------------------------- diff --git a/src/backend/executor/nodeBitmapOr.c b/src/backend/executor/nodeBitmapOr.c index dcd7ceb2972..148c80fdae6 100644 --- a/src/backend/executor/nodeBitmapOr.c +++ b/src/backend/executor/nodeBitmapOr.c @@ -29,7 +29,9 @@ #include "postgres.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "executor/nodeBitmapOr.h" +#include "nodes/tidbitmap.h" #include "miscadmin.h" diff --git a/src/backend/executor/nodeCtescan.c b/src/backend/executor/nodeCtescan.c index 45b09d93b93..d3a8551e801 100644 --- a/src/backend/executor/nodeCtescan.c +++ b/src/backend/executor/nodeCtescan.c @@ -18,6 +18,7 @@ #include "executor/executor.h" #include "executor/nodeCtescan.h" #include "miscadmin.h" +#include "utils/tuplestore.h" static TupleTableSlot *CteScanNext(CteScanState *node); diff --git a/src/backend/executor/nodeFunctionscan.c b/src/backend/executor/nodeFunctionscan.c index 222741adf3b..1416f1f09ae 100644 --- a/src/backend/executor/nodeFunctionscan.c +++ b/src/backend/executor/nodeFunctionscan.c @@ -27,6 +27,7 @@ #include "funcapi.h" #include "nodes/nodeFuncs.h" #include "utils/memutils.h" +#include "utils/tuplestore.h" /* diff --git a/src/backend/executor/nodeGatherMerge.c b/src/backend/executor/nodeGatherMerge.c index ae212194182..c2ac5e0792c 100644 --- a/src/backend/executor/nodeGatherMerge.c +++ b/src/backend/executor/nodeGatherMerge.c @@ -22,6 +22,7 @@ #include "lib/binaryheap.h" #include "miscadmin.h" #include "optimizer/optimizer.h" +#include "utils/sortsupport.h" /* * When we read tuples from workers, it's a good idea to read several at once diff --git a/src/backend/executor/nodeGroup.c b/src/backend/executor/nodeGroup.c index 1cd84011567..3699d8a3746 100644 --- a/src/backend/executor/nodeGroup.c +++ b/src/backend/executor/nodeGroup.c @@ -23,6 +23,7 @@ #include "postgres.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "executor/nodeGroup.h" #include "miscadmin.h" diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c index c0eb5a1f0c5..f7fd6474db8 100644 --- a/src/backend/executor/nodeHash.c +++ b/src/backend/executor/nodeHash.c @@ -32,6 +32,7 @@ #include "commands/tablespace.h" #include "executor/executor.h" #include "executor/hashjoin.h" +#include "executor/instrument.h" #include "executor/nodeHash.h" #include "executor/nodeHashjoin.h" #include "miscadmin.h" diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c index 5aa8a09b265..fe96bd556ef 100644 --- a/src/backend/executor/nodeHashjoin.c +++ b/src/backend/executor/nodeHashjoin.c @@ -166,6 +166,7 @@ #include "access/parallel.h" #include "executor/executor.h" #include "executor/hashjoin.h" +#include "executor/instrument.h" #include "executor/nodeHash.h" #include "executor/nodeHashjoin.h" #include "miscadmin.h" diff --git a/src/backend/executor/nodeIndexonlyscan.c b/src/backend/executor/nodeIndexonlyscan.c index bdd836e0fb1..c8db357e69f 100644 --- a/src/backend/executor/nodeIndexonlyscan.c +++ b/src/backend/executor/nodeIndexonlyscan.c @@ -37,6 +37,7 @@ #include "access/visibilitymap.h" #include "catalog/pg_type.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "executor/nodeIndexonlyscan.h" #include "executor/nodeIndexscan.h" #include "miscadmin.h" diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c index 36c00d0e20c..bd83e4712b3 100644 --- a/src/backend/executor/nodeIndexscan.c +++ b/src/backend/executor/nodeIndexscan.c @@ -34,6 +34,7 @@ #include "access/tableam.h" #include "catalog/pg_am.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "executor/nodeIndexscan.h" #include "lib/pairingheap.h" #include "miscadmin.h" @@ -42,6 +43,7 @@ #include "utils/datum.h" #include "utils/lsyscache.h" #include "utils/rel.h" +#include "utils/sortsupport.h" /* * When an ordering operator is used, tuples fetched from the index that diff --git a/src/backend/executor/nodeMaterial.c b/src/backend/executor/nodeMaterial.c index 764032df6c6..e5f387612bc 100644 --- a/src/backend/executor/nodeMaterial.c +++ b/src/backend/executor/nodeMaterial.c @@ -24,6 +24,7 @@ #include "executor/executor.h" #include "executor/nodeMaterial.h" #include "miscadmin.h" +#include "utils/tuplestore.h" /* ---------------------------------------------------------------- * ExecMaterial diff --git a/src/backend/executor/nodeMergeAppend.c b/src/backend/executor/nodeMergeAppend.c index 30bfeaf7c13..72eebd50bdf 100644 --- a/src/backend/executor/nodeMergeAppend.c +++ b/src/backend/executor/nodeMergeAppend.c @@ -43,6 +43,7 @@ #include "executor/nodeMergeAppend.h" #include "lib/binaryheap.h" #include "miscadmin.h" +#include "utils/sortsupport.h" /* * We have one slot for each item in the heap array. We use SlotNumber diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c index cbcae4c70b8..f8421a74c75 100644 --- a/src/backend/executor/nodeMergejoin.c +++ b/src/backend/executor/nodeMergejoin.c @@ -94,9 +94,11 @@ #include "access/nbtree.h" #include "executor/execdebug.h" +#include "executor/instrument.h" #include "executor/nodeMergejoin.h" #include "miscadmin.h" #include "utils/lsyscache.h" +#include "utils/sortsupport.h" /* diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index 327c27abff9..4cd5e262e0f 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -54,10 +54,12 @@ #include "access/htup_details.h" #include "access/tableam.h" +#include "access/tupconvert.h" #include "access/xact.h" #include "commands/trigger.h" #include "executor/execPartition.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "executor/nodeModifyTable.h" #include "foreign/fdwapi.h" #include "miscadmin.h" diff --git a/src/backend/executor/nodeNamedtuplestorescan.c b/src/backend/executor/nodeNamedtuplestorescan.c index 29d862a4001..4c94674ceca 100644 --- a/src/backend/executor/nodeNamedtuplestorescan.c +++ b/src/backend/executor/nodeNamedtuplestorescan.c @@ -18,6 +18,7 @@ #include "executor/executor.h" #include "executor/nodeNamedtuplestorescan.h" #include "utils/queryenvironment.h" +#include "utils/tuplestore.h" static TupleTableSlot *NamedTuplestoreScanNext(NamedTuplestoreScanState *node); diff --git a/src/backend/executor/nodeNestloop.c b/src/backend/executor/nodeNestloop.c index df3f6328ade..809311ab513 100644 --- a/src/backend/executor/nodeNestloop.c +++ b/src/backend/executor/nodeNestloop.c @@ -22,6 +22,7 @@ #include "postgres.h" #include "executor/execdebug.h" +#include "executor/instrument.h" #include "executor/nodeNestloop.h" #include "miscadmin.h" diff --git a/src/backend/executor/nodeRecursiveunion.c b/src/backend/executor/nodeRecursiveunion.c index 5098ddeabb6..7166397e59b 100644 --- a/src/backend/executor/nodeRecursiveunion.c +++ b/src/backend/executor/nodeRecursiveunion.c @@ -22,6 +22,7 @@ #include "executor/nodeRecursiveunion.h" #include "miscadmin.h" #include "utils/memutils.h" +#include "utils/tuplestore.h" diff --git a/src/backend/executor/nodeSetOp.c b/src/backend/executor/nodeSetOp.c index 24cd713b12c..24709778384 100644 --- a/src/backend/executor/nodeSetOp.c +++ b/src/backend/executor/nodeSetOp.c @@ -50,6 +50,7 @@ #include "executor/nodeSetOp.h" #include "miscadmin.h" #include "utils/memutils.h" +#include "utils/sortsupport.h" /* diff --git a/src/backend/executor/nodeTableFuncscan.c b/src/backend/executor/nodeTableFuncscan.c index 769b9766542..9394156f405 100644 --- a/src/backend/executor/nodeTableFuncscan.c +++ b/src/backend/executor/nodeTableFuncscan.c @@ -31,6 +31,7 @@ #include "utils/jsonpath.h" #include "utils/lsyscache.h" #include "utils/memutils.h" +#include "utils/tuplestore.h" #include "utils/xml.h" static TupleTableSlot *TableFuncNext(TableFuncScanState *node); diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c index d9b64b0f465..784ceeb8246 100644 --- a/src/backend/executor/nodeWindowAgg.c +++ b/src/backend/executor/nodeWindowAgg.c @@ -38,6 +38,7 @@ #include "catalog/pg_aggregate.h" #include "catalog/pg_proc.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "executor/nodeWindowAgg.h" #include "miscadmin.h" #include "nodes/nodeFuncs.h" @@ -53,6 +54,7 @@ #include "utils/memutils.h" #include "utils/regproc.h" #include "utils/syscache.h" +#include "utils/tuplestore.h" #include "windowapi.h" /* diff --git a/src/backend/executor/nodeWorktablescan.c b/src/backend/executor/nodeWorktablescan.c index 66e904c7636..bbceb9b9437 100644 --- a/src/backend/executor/nodeWorktablescan.c +++ b/src/backend/executor/nodeWorktablescan.c @@ -17,6 +17,7 @@ #include "executor/executor.h" #include "executor/nodeWorktablescan.h" +#include "utils/tuplestore.h" static TupleTableSlot *WorkTableScanNext(WorkTableScanState *node); diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index 3019a3b2b97..52f3b11301c 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -32,6 +32,7 @@ #include "utils/rel.h" #include "utils/snapmgr.h" #include "utils/syscache.h" +#include "utils/tuplestore.h" #include "utils/typcache.h" diff --git a/src/backend/foreign/foreign.c b/src/backend/foreign/foreign.c index 160cf6f51c9..2edfac68d9b 100644 --- a/src/backend/foreign/foreign.c +++ b/src/backend/foreign/foreign.c @@ -28,6 +28,7 @@ #include "utils/memutils.h" #include "utils/rel.h" #include "utils/syscache.h" +#include "utils/tuplestore.h" #include "utils/varlena.h" diff --git a/src/backend/jit/jit.c b/src/backend/jit/jit.c index e92be36932b..fd930bdca3a 100644 --- a/src/backend/jit/jit.c +++ b/src/backend/jit/jit.c @@ -26,6 +26,7 @@ #include "miscadmin.h" #include "nodes/execnodes.h" #include "portability/instr_time.h" +#include "storage/fd.h" #include "utils/fmgrprotos.h" /* GUCs */ diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index 89ca4e08bf1..56d45287c89 100644 --- a/src/backend/optimizer/path/costsize.c +++ b/src/backend/optimizer/path/costsize.c @@ -95,6 +95,7 @@ #include "miscadmin.h" #include "nodes/makefuncs.h" #include "nodes/nodeFuncs.h" +#include "nodes/tidbitmap.h" #include "optimizer/clauses.h" #include "optimizer/cost.h" #include "optimizer/optimizer.h" diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c index 9aaf1c4e5ca..c20e7e49780 100644 --- a/src/backend/optimizer/plan/initsplan.c +++ b/src/backend/optimizer/plan/initsplan.c @@ -15,6 +15,7 @@ #include "postgres.h" #include "access/nbtree.h" +#include "access/sysattr.h" #include "catalog/pg_constraint.h" #include "catalog/pg_type.h" #include "nodes/makefuncs.h" diff --git a/src/backend/optimizer/prep/preptlist.c b/src/backend/optimizer/prep/preptlist.c index ff9c7c4fb96..1647066a13d 100644 --- a/src/backend/optimizer/prep/preptlist.c +++ b/src/backend/optimizer/prep/preptlist.c @@ -36,7 +36,9 @@ #include "postgres.h" +#include "access/sysattr.h" #include "access/table.h" +#include "catalog/pg_type_d.h" #include "nodes/makefuncs.h" #include "optimizer/appendinfo.h" #include "optimizer/optimizer.h" diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c index f50c296e3d9..583cb0b7a25 100644 --- a/src/backend/optimizer/prep/prepunion.c +++ b/src/backend/optimizer/prep/prepunion.c @@ -37,6 +37,7 @@ #include "optimizer/prep.h" #include "optimizer/tlist.h" #include "parser/parse_coerce.h" +#include "port/pg_bitutils.h" #include "utils/selfuncs.h" diff --git a/src/backend/optimizer/util/appendinfo.c b/src/backend/optimizer/util/appendinfo.c index eadecd0bb92..778e4662f6e 100644 --- a/src/backend/optimizer/util/appendinfo.c +++ b/src/backend/optimizer/util/appendinfo.c @@ -15,6 +15,7 @@ #include "postgres.h" #include "access/htup_details.h" +#include "access/sysattr.h" #include "access/table.h" #include "foreign/fdwapi.h" #include "nodes/makefuncs.h" diff --git a/src/backend/optimizer/util/predtest.c b/src/backend/optimizer/util/predtest.c index fe15881af4e..690a23d619a 100644 --- a/src/backend/optimizer/util/predtest.c +++ b/src/backend/optimizer/util/predtest.c @@ -25,6 +25,7 @@ #include "nodes/pathnodes.h" #include "optimizer/optimizer.h" #include "utils/array.h" +#include "utils/hsearch.h" #include "utils/inval.h" #include "utils/lsyscache.h" #include "utils/syscache.h" diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index cc244c49e9e..9a918e14aa7 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -23,6 +23,7 @@ #include "postgres.h" #include "access/amapi.h" +#include "access/attmap.h" #include "access/htup_details.h" #include "access/relation.h" #include "access/reloptions.h" diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 695e187ba11..219673db930 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -90,6 +90,7 @@ #include "storage/aio_subsys.h" #include "storage/bufmgr.h" #include "storage/ipc.h" +#include "storage/fd.h" #include "storage/latch.h" #include "storage/lmgr.h" #include "storage/pmsignal.h" diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c index 033858752d9..2d7708805a6 100644 --- a/src/backend/replication/logical/worker.c +++ b/src/backend/replication/logical/worker.c @@ -250,6 +250,7 @@ #include "access/commit_ts.h" #include "access/table.h" #include "access/tableam.h" +#include "access/tupconvert.h" #include "access/twophase.h" #include "access/xact.h" #include "catalog/indexing.h" @@ -266,6 +267,7 @@ #include "optimizer/optimizer.h" #include "parser/parse_relation.h" #include "pgstat.h" +#include "port/pg_bitutils.h" #include "postmaster/bgworker.h" #include "postmaster/interrupt.h" #include "postmaster/walwriter.h" diff --git a/src/backend/rewrite/rewriteGraphTable.c b/src/backend/rewrite/rewriteGraphTable.c index bbf3316dfd1..06f2f3442d8 100644 --- a/src/backend/rewrite/rewriteGraphTable.c +++ b/src/backend/rewrite/rewriteGraphTable.c @@ -14,6 +14,7 @@ #include "postgres.h" #include "access/genam.h" +#include "access/sysattr.h" #include "access/table.h" #include "access/htup_details.h" #include "catalog/pg_operator.h" diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c index 6fa174412f2..fe89754a73c 100644 --- a/src/backend/rewrite/rewriteManip.c +++ b/src/backend/rewrite/rewriteManip.c @@ -13,6 +13,7 @@ */ #include "postgres.h" +#include "access/attmap.h" #include "catalog/pg_type.h" #include "nodes/makefuncs.h" #include "nodes/nodeFuncs.h" diff --git a/src/backend/storage/ipc/dsm_registry.c b/src/backend/storage/ipc/dsm_registry.c index 068c1577b12..9bfcd616827 100644 --- a/src/backend/storage/ipc/dsm_registry.c +++ b/src/backend/storage/ipc/dsm_registry.c @@ -47,6 +47,7 @@ #include "storage/shmem.h" #include "utils/builtins.h" #include "utils/memutils.h" +#include "utils/tuplestore.h" typedef struct DSMRegistryCtxStruct { diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c index 55e4a5421de..0424c445723 100644 --- a/src/backend/storage/ipc/shmem.c +++ b/src/backend/storage/ipc/shmem.c @@ -65,6 +65,8 @@ #include "postgres.h" +#include + #include "common/int.h" #include "fmgr.h" #include "funcapi.h" @@ -75,6 +77,7 @@ #include "storage/shmem.h" #include "storage/spin.h" #include "utils/builtins.h" +#include "utils/tuplestore.h" /* * This is the first data structure stored in the shared memory segment, at diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index d01a09dd0c4..b3563113219 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -63,6 +63,7 @@ #include "rewrite/rewriteHandler.h" #include "storage/bufmgr.h" #include "storage/ipc.h" +#include "storage/fd.h" #include "storage/pmsignal.h" #include "storage/proc.h" #include "storage/procsignal.h" diff --git a/src/backend/utils/activity/wait_event_funcs.c b/src/backend/utils/activity/wait_event_funcs.c index fa10a80b088..ff683ae8c5d 100644 --- a/src/backend/utils/activity/wait_event_funcs.c +++ b/src/backend/utils/activity/wait_event_funcs.c @@ -16,6 +16,7 @@ #include "funcapi.h" #include "utils/builtins.h" +#include "utils/tuplestore.h" #include "utils/wait_event.h" /* diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index 7ab91fbb06d..b9190e700dc 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -40,6 +40,7 @@ #include "lib/bloomfilter.h" #include "lib/qunique.h" #include "miscadmin.h" +#include "port/pg_bitutils.h" #include "storage/large_object.h" #include "utils/acl.h" #include "utils/array.h" diff --git a/src/backend/utils/adt/arraysubs.c b/src/backend/utils/adt/arraysubs.c index 63c78ed12cd..2bf9e9509fb 100644 --- a/src/backend/utils/adt/arraysubs.c +++ b/src/backend/utils/adt/arraysubs.c @@ -14,6 +14,7 @@ */ #include "postgres.h" +#include "catalog/pg_type_d.h" #include "executor/execExpr.h" #include "nodes/makefuncs.h" #include "nodes/nodeFuncs.h" diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 90946db72ff..8f25c15fcfc 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -30,6 +30,7 @@ #include "utils/date.h" #include "utils/datetime.h" #include "utils/guc.h" +#include "utils/tuplestore.h" #include "utils/tzparser.h" static int DecodeNumber(int flen, char *str, bool haveTextMonth, diff --git a/src/backend/utils/adt/hbafuncs.c b/src/backend/utils/adt/hbafuncs.c index e7432c447e7..fdce3ed7927 100644 --- a/src/backend/utils/adt/hbafuncs.c +++ b/src/backend/utils/adt/hbafuncs.c @@ -22,6 +22,7 @@ #include "utils/array.h" #include "utils/builtins.h" #include "utils/guc.h" +#include "utils/tuplestore.h" static ArrayType *get_hba_options(HbaLine *hba); diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c index 0b161398465..ab38ddb9079 100644 --- a/src/backend/utils/adt/json.c +++ b/src/backend/utils/adt/json.c @@ -26,6 +26,7 @@ #include "utils/date.h" #include "utils/datetime.h" #include "utils/fmgroids.h" +#include "utils/hsearch.h" #include "utils/json.h" #include "utils/jsonfuncs.h" #include "utils/lsyscache.h" diff --git a/src/backend/utils/adt/jsonbsubs.c b/src/backend/utils/adt/jsonbsubs.c index 6bf55f19d6a..f2745b29a3f 100644 --- a/src/backend/utils/adt/jsonbsubs.c +++ b/src/backend/utils/adt/jsonbsubs.c @@ -14,6 +14,7 @@ */ #include "postgres.h" +#include "catalog/pg_type_d.h" #include "executor/execExpr.h" #include "nodes/nodeFuncs.h" #include "nodes/subscripting.h" diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c index d5b64d7fca5..efdf60ca5a5 100644 --- a/src/backend/utils/adt/jsonfuncs.c +++ b/src/backend/utils/adt/jsonfuncs.c @@ -38,6 +38,7 @@ #include "utils/lsyscache.h" #include "utils/memutils.h" #include "utils/syscache.h" +#include "utils/tuplestore.h" #include "utils/typcache.h" /* Operations available for setPath */ diff --git a/src/backend/utils/adt/mcxtfuncs.c b/src/backend/utils/adt/mcxtfuncs.c index c7f7b8bc2dd..1a4dbbeb8db 100644 --- a/src/backend/utils/adt/mcxtfuncs.c +++ b/src/backend/utils/adt/mcxtfuncs.c @@ -15,6 +15,7 @@ #include "postgres.h" +#include "catalog/pg_type_d.h" #include "funcapi.h" #include "mb/pg_wchar.h" #include "storage/proc.h" @@ -23,6 +24,7 @@ #include "utils/array.h" #include "utils/builtins.h" #include "utils/hsearch.h" +#include "utils/tuplestore.h" /* ---------- * The max bytes for showing identifiers of MemoryContext. diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c index 864032c32bf..29ef800d992 100644 --- a/src/backend/utils/adt/misc.c +++ b/src/backend/utils/adt/misc.c @@ -46,6 +46,7 @@ #include "utils/ruleutils.h" #include "utils/syscache.h" #include "utils/timestamp.h" +#include "utils/tuplestore.h" #include "utils/wait_event.h" diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c index bad5642d9c9..5f907335990 100644 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@ -31,6 +31,7 @@ #include "utils/acl.h" #include "utils/builtins.h" #include "utils/timestamp.h" +#include "utils/tuplestore.h" #include "utils/wait_event.h" #define UINT32_ACCESS_ONCE(var) ((uint32)(*((volatile uint32 *)&(var)))) diff --git a/src/backend/utils/adt/rangetypes.c b/src/backend/utils/adt/rangetypes.c index 06cc3af4f4a..92dacd73dec 100644 --- a/src/backend/utils/adt/rangetypes.c +++ b/src/backend/utils/adt/rangetypes.c @@ -30,6 +30,7 @@ */ #include "postgres.h" +#include "access/tupmacs.h" #include "common/hashfn.h" #include "funcapi.h" #include "libpq/pqformat.h" @@ -40,6 +41,7 @@ #include "optimizer/clauses.h" #include "optimizer/cost.h" #include "optimizer/optimizer.h" +#include "port/pg_bitutils.h" #include "utils/builtins.h" #include "utils/date.h" #include "utils/lsyscache.h" diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index 7caf700fd61..7b1ee61bde6 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -19,6 +19,7 @@ #include "access/detoast.h" #include "access/toast_compression.h" +#include "access/tupmacs.h" #include "catalog/pg_collation.h" #include "catalog/pg_type.h" #include "common/hashfn.h" @@ -40,6 +41,7 @@ #include "utils/memutils.h" #include "utils/pg_locale.h" #include "utils/sortsupport.h" +#include "utils/tuplestore.h" #include "utils/varlena.h" typedef varlena VarString; diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 597de687b45..3a4f19e8d58 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -75,6 +75,7 @@ #include "pgstat.h" #include "rewrite/rewriteDefine.h" #include "rewrite/rowsecurity.h" +#include "storage/fd.h" #include "storage/lmgr.h" #include "storage/smgr.h" #include "utils/array.h" diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c index 4e26df7c63a..bfeceb7a92f 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -31,6 +31,7 @@ #include "utils/builtins.h" #include "utils/fmgrtab.h" #include "utils/guc.h" +#include "utils/hsearch.h" #include "utils/lsyscache.h" #include "utils/syscache.h" diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index b59e08605cc..26118661f07 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -38,6 +38,7 @@ #include "mb/pg_wchar.h" #include "miscadmin.h" #include "pgstat.h" +#include "port/pg_bitutils.h" #include "postmaster/autovacuum.h" #include "postmaster/postmaster.h" #include "replication/slot.h" diff --git a/src/backend/utils/misc/guc_funcs.c b/src/backend/utils/misc/guc_funcs.c index 472cb5393ce..e2c2919484e 100644 --- a/src/backend/utils/misc/guc_funcs.c +++ b/src/backend/utils/misc/guc_funcs.c @@ -22,6 +22,7 @@ #include "catalog/objectaccess.h" #include "catalog/pg_authid.h" #include "catalog/pg_parameter_acl.h" +#include "catalog/pg_type_d.h" #include "funcapi.h" #include "guc_internal.h" #include "miscadmin.h" @@ -30,6 +31,7 @@ #include "utils/builtins.h" #include "utils/guc_tables.h" #include "utils/snapmgr.h" +#include "utils/tuplestore.h" static char *flatten_set_variable_args(const char *name, List *args); static void ShowGUCConfigOption(const char *name, DestReceiver *dest); diff --git a/src/backend/utils/misc/pg_config.c b/src/backend/utils/misc/pg_config.c index 210e3a50ff9..1d9d7985cf1 100644 --- a/src/backend/utils/misc/pg_config.c +++ b/src/backend/utils/misc/pg_config.c @@ -18,6 +18,7 @@ #include "funcapi.h" #include "miscadmin.h" #include "utils/builtins.h" +#include "utils/tuplestore.h" Datum pg_config(PG_FUNCTION_ARGS) diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c index c1a53e658cb..493f9b0ee19 100644 --- a/src/backend/utils/mmgr/portalmem.c +++ b/src/backend/utils/mmgr/portalmem.c @@ -24,9 +24,11 @@ #include "miscadmin.h" #include "storage/ipc.h" #include "utils/builtins.h" +#include "utils/hsearch.h" #include "utils/memutils.h" #include "utils/snapmgr.h" #include "utils/timestamp.h" +#include "utils/tuplestore.h" /* * Estimate of the maximum number of open portals a user would have, diff --git a/src/backend/utils/sort/tuplestore.c b/src/backend/utils/sort/tuplestore.c index afba82f28a2..273a4c9b02f 100644 --- a/src/backend/utils/sort/tuplestore.c +++ b/src/backend/utils/sort/tuplestore.c @@ -63,6 +63,7 @@ #include "storage/buffile.h" #include "utils/memutils.h" #include "utils/resowner.h" +#include "utils/tuplestore.h" /* diff --git a/src/include/access/genam.h b/src/include/access/genam.h index 4c0429cc613..1a27bf060b3 100644 --- a/src/include/access/genam.h +++ b/src/include/access/genam.h @@ -18,17 +18,19 @@ #include "access/sdir.h" #include "access/skey.h" #include "executor/instrument_node.h" -#include "nodes/tidbitmap.h" #include "storage/buf.h" #include "storage/lockdefs.h" #include "utils/snapshot.h" -/* We don't want this file to depend on execnodes.h. */ + +/* + * forward references in this file + */ typedef struct IndexInfo IndexInfo; +typedef struct RelationData *Relation; +typedef struct TIDBitmap TIDBitmap; typedef struct TupleTableSlot TupleTableSlot; -/* or relcache.h */ -typedef struct RelationData *Relation; /* * Struct for statistics returned by ambuild diff --git a/src/include/access/gin_private.h b/src/include/access/gin_private.h index 7c3b4db94cd..4445d088fa0 100644 --- a/src/include/access/gin_private.h +++ b/src/include/access/gin_private.h @@ -19,6 +19,7 @@ #include "catalog/pg_am_d.h" #include "fmgr.h" #include "lib/rbtree.h" +#include "nodes/tidbitmap.h" #include "storage/bufmgr.h" /* diff --git a/src/include/bootstrap/bootstrap.h b/src/include/bootstrap/bootstrap.h index e967b2b1885..c0bba03a5ee 100644 --- a/src/include/bootstrap/bootstrap.h +++ b/src/include/bootstrap/bootstrap.h @@ -14,6 +14,7 @@ #ifndef BOOTSTRAP_H #define BOOTSTRAP_H +#include "catalog/pg_attribute.h" #include "nodes/execnodes.h" #include "nodes/parsenodes.h" diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h index b259c4141ed..36b70689254 100644 --- a/src/include/catalog/index.h +++ b/src/include/catalog/index.h @@ -18,6 +18,12 @@ #include "nodes/execnodes.h" +/* + * forward references in this file + */ +typedef struct AttrMap AttrMap; + + #define DEFAULT_INDEX_TYPE "btree" /* Action code for index_set_state_flags */ diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h index 86226f8db70..472e141bba3 100644 --- a/src/include/commands/explain.h +++ b/src/include/commands/explain.h @@ -14,6 +14,7 @@ #define EXPLAIN_H #include "executor/executor.h" +#include "executor/instrument.h" #include "parser/parse_node.h" typedef struct ExplainState ExplainState; /* defined in explain_state.h */ diff --git a/src/include/commands/explain_state.h b/src/include/commands/explain_state.h index 0b695f7d812..5a48bc6fbb1 100644 --- a/src/include/commands/explain_state.h +++ b/src/include/commands/explain_state.h @@ -16,6 +16,7 @@ #include "nodes/parsenodes.h" #include "nodes/plannodes.h" #include "parser/parse_node.h" +#include "port/pg_bitutils.h" typedef enum ExplainSerializeOption { diff --git a/src/include/executor/execScan.h b/src/include/executor/execScan.h index 028edb8d9fd..18b03235c3c 100644 --- a/src/include/executor/execScan.h +++ b/src/include/executor/execScan.h @@ -15,6 +15,7 @@ #include "miscadmin.h" #include "executor/executor.h" +#include "executor/instrument.h" #include "nodes/execnodes.h" /* diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index b1820653506..064df01811e 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -14,6 +14,7 @@ #ifndef EXECUTOR_H #define EXECUTOR_H +#include "access/xlogdefs.h" #include "datatype/timestamp.h" #include "executor/execdesc.h" #include "fmgr.h" diff --git a/src/include/executor/hashjoin.h b/src/include/executor/hashjoin.h index 781ba266a8b..9cc82cdea4b 100644 --- a/src/include/executor/hashjoin.h +++ b/src/include/executor/hashjoin.h @@ -19,6 +19,8 @@ #include "storage/barrier.h" #include "storage/buffile.h" #include "storage/lwlock.h" +#include "utils/dsa.h" +#include "utils/sharedtuplestore.h" /* ---------------------------------------------------------------- * hash-join hash table structures diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h index 848719232a4..15af488abfb 100644 --- a/src/include/lib/simplehash.h +++ b/src/include/lib/simplehash.h @@ -93,7 +93,6 @@ * src/include/lib/simplehash.h */ -#include "port/pg_bitutils.h" /* helpers */ #define SH_MAKE_PREFIX(a) CppConcat(a,_) @@ -255,6 +254,8 @@ SH_SCOPE void SH_STAT(SH_TYPE * tb); /* generate implementation of the hash table */ #ifdef SH_DEFINE +#include "port/pg_bitutils.h" + #ifndef SH_RAW_ALLOCATOR #include "utils/memutils.h" #endif diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 63c067d5aae..0716c5a9aed 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -29,35 +29,44 @@ #ifndef EXECNODES_H #define EXECNODES_H -#include "access/skey.h" -#include "access/tupconvert.h" -#include "executor/instrument.h" +#include "access/htup.h" #include "executor/instrument_node.h" #include "fmgr.h" #include "lib/ilist.h" -#include "lib/pairingheap.h" #include "nodes/miscnodes.h" #include "nodes/params.h" #include "nodes/plannodes.h" -#include "nodes/tidbitmap.h" #include "partitioning/partdefs.h" -#include "storage/condition_variable.h" -#include "utils/hsearch.h" -#include "utils/queryenvironment.h" +#include "storage/buf.h" #include "utils/reltrigger.h" -#include "utils/sharedtuplestore.h" -#include "utils/snapshot.h" -#include "utils/sortsupport.h" -#include "utils/tuplesort.h" -#include "utils/tuplestore.h" + /* * forward references in this file */ -typedef struct PlanState PlanState; +typedef struct BufferUsage BufferUsage; typedef struct ExecRowMark ExecRowMark; typedef struct ExprState ExprState; typedef struct ExprContext ExprContext; +typedef struct HTAB HTAB; +typedef struct Instrumentation Instrumentation; +typedef struct pairingheap pairingheap; +typedef struct PlanState PlanState; +typedef struct QueryEnvironment QueryEnvironment; +typedef struct RelationData *Relation; +typedef Relation *RelationPtr; +typedef struct ScanKeyData ScanKeyData; +typedef struct SnapshotData *Snapshot; +typedef struct SortSupportData *SortSupport; +typedef struct TIDBitmap TIDBitmap; +typedef struct TupleConversionMap TupleConversionMap; +typedef struct TupleDescData *TupleDesc; +typedef struct Tuplesortstate Tuplesortstate; +typedef struct Tuplestorestate Tuplestorestate; +typedef struct TupleTableSlot TupleTableSlot; +typedef struct TupleTableSlotOps TupleTableSlotOps; +typedef struct WalUsage WalUsage; +typedef struct WorkerInstrumentation WorkerInstrumentation; /* ---------------- @@ -1819,41 +1828,6 @@ typedef struct BitmapIndexScanState SharedIndexScanInstrumentation *biss_SharedInfo; } BitmapIndexScanState; -/* ---------------- - * SharedBitmapState information - * - * BM_INITIAL TIDBitmap creation is not yet started, so first worker - * to see this state will set the state to BM_INPROGRESS - * and that process will be responsible for creating - * TIDBitmap. - * BM_INPROGRESS TIDBitmap creation is in progress; workers need to - * sleep until it's finished. - * BM_FINISHED TIDBitmap creation is done, so now all workers can - * proceed to iterate over TIDBitmap. - * ---------------- - */ -typedef enum -{ - BM_INITIAL, - BM_INPROGRESS, - BM_FINISHED, -} SharedBitmapState; - -/* ---------------- - * ParallelBitmapHeapState information - * tbmiterator iterator for scanning current pages - * mutex mutual exclusion for state - * state current state of the TIDBitmap - * cv conditional wait variable - * ---------------- - */ -typedef struct ParallelBitmapHeapState -{ - dsa_pointer tbmiterator; - slock_t mutex; - SharedBitmapState state; - ConditionVariable cv; -} ParallelBitmapHeapState; /* ---------------- * BitmapHeapScanState information @@ -1867,6 +1841,10 @@ typedef struct ParallelBitmapHeapState * recheck do current page's tuples need recheck * ---------------- */ + +/* this struct is defined in nodeBitmapHeapscan.c */ +typedef struct ParallelBitmapHeapState ParallelBitmapHeapState; + typedef struct BitmapHeapScanState { ScanState ss; /* its first field is NodeTag */ diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h index 8c9321aab8c..b6185825fcb 100644 --- a/src/include/nodes/plannodes.h +++ b/src/include/nodes/plannodes.h @@ -16,8 +16,6 @@ #include "access/sdir.h" #include "access/stratnum.h" -#include "common/relpath.h" -#include "lib/stringinfo.h" #include "nodes/bitmapset.h" #include "nodes/lockoptions.h" #include "nodes/primnodes.h" diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 02eced3b2c5..c5f11b874c7 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -35,6 +35,7 @@ #include "utils/memutils.h" #include "utils/rel.h" #include "utils/syscache.h" +#include "utils/tuplestore.h" #include "utils/typcache.h" /* define our text domain for translations */ diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c index b7318f7261e..44491de669a 100644 --- a/src/pl/tcl/pltcl.c +++ b/src/pl/tcl/pltcl.c @@ -36,6 +36,7 @@ #include "utils/regproc.h" #include "utils/rel.h" #include "utils/syscache.h" +#include "utils/tuplestore.h" #include "utils/typcache.h" diff --git a/src/test/modules/injection_points/injection_points.c b/src/test/modules/injection_points/injection_points.c index 3de0491e0ec..d59c5ad0582 100644 --- a/src/test/modules/injection_points/injection_points.c +++ b/src/test/modules/injection_points/injection_points.c @@ -31,6 +31,7 @@ #include "utils/guc.h" #include "utils/injection_point.h" #include "utils/memutils.h" +#include "utils/tuplestore.h" #include "utils/wait_event.h" PG_MODULE_MAGIC; 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 da28afbd929..2ef0e903745 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 @@ -16,6 +16,7 @@ #include "common/hashfn.h" #include "funcapi.h" #include "storage/dsm_registry.h" +#include "storage/fd.h" #include "utils/builtins.h" #include "utils/pgstat_internal.h" diff --git a/src/test/modules/test_ddl_deparse/test_ddl_deparse.c b/src/test/modules/test_ddl_deparse/test_ddl_deparse.c index 380b3e754b7..64a1dfa9f79 100644 --- a/src/test/modules/test_ddl_deparse/test_ddl_deparse.c +++ b/src/test/modules/test_ddl_deparse/test_ddl_deparse.c @@ -15,6 +15,7 @@ #include "tcop/deparse_utility.h" #include "tcop/utility.h" #include "utils/builtins.h" +#include "utils/tuplestore.h" PG_MODULE_MAGIC; diff --git a/src/test/modules/test_regex/test_regex.c b/src/test/modules/test_regex/test_regex.c index 4e97cde65a6..cfe569aa060 100644 --- a/src/test/modules/test_regex/test_regex.c +++ b/src/test/modules/test_regex/test_regex.c @@ -14,6 +14,7 @@ #include "postgres.h" +#include "catalog/pg_type_d.h" #include "funcapi.h" #include "regex/regex.h" #include "utils/array.h"