]> granicus.if.org Git - postgresql/commitdiff
Refactor planner's header files.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 29 Jan 2019 20:48:51 +0000 (15:48 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 29 Jan 2019 20:48:51 +0000 (15:48 -0500)
Create a new header optimizer/optimizer.h, which exposes just the
planner functions that can be used "at arm's length", without need
to access Paths or the other planner-internal data structures defined
in nodes/relation.h.  This is intended to provide the whole planner
API seen by most of the rest of the system; although FDWs still need
to use additional stuff, and more thought is also needed about just
what selfuncs.c should rely on.

The main point of doing this now is to limit the amount of new
#include baggage that will be needed by "planner support functions",
which I expect to introduce later, and which will be in relevant
datatype modules rather than anywhere near the planner.

This commit just moves relevant declarations into optimizer.h from
other header files (a couple of which go away because everything
got moved), and adjusts #include lists to match.  There's further
cleanup that could be done if we want to decide that some stuff
being exposed by optimizer.h doesn't belong in the planner at all,
but I'll leave that for another day.

Discussion: https://postgr.es/m/11460.1548706639@sss.pgh.pa.us

91 files changed:
contrib/bloom/blcost.c
contrib/file_fdw/file_fdw.c
contrib/postgres_fdw/deparse.c
contrib/postgres_fdw/postgres_fdw.c
contrib/tsm_system_rows/tsm_system_rows.c
contrib/tsm_system_time/tsm_system_time.c
src/backend/access/gist/gistbuild.c
src/backend/access/spgist/spgutils.c
src/backend/access/tablesample/bernoulli.c
src/backend/access/tablesample/system.c
src/backend/access/transam/parallel.c
src/backend/catalog/heap.c
src/backend/catalog/index.c
src/backend/catalog/partition.c
src/backend/commands/cluster.c
src/backend/commands/copy.c
src/backend/commands/explain.c
src/backend/commands/functioncmds.c
src/backend/commands/indexcmds.c
src/backend/commands/tablecmds.c
src/backend/commands/trigger.c
src/backend/commands/typecmds.c
src/backend/executor/execExpr.c
src/backend/executor/execMain.c
src/backend/executor/execParallel.c
src/backend/executor/nodeAgg.c
src/backend/executor/nodeGather.c
src/backend/executor/nodeGatherMerge.c
src/backend/executor/nodeIndexscan.c
src/backend/executor/nodeWindowAgg.c
src/backend/jit/llvm/llvmjit_expr.c
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/clausesel.c
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/equivclass.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/pathkeys.c
src/backend/optimizer/path/tidpath.c
src/backend/optimizer/plan/analyzejoins.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/planagg.c
src/backend/optimizer/plan/planmain.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/plan/subselect.c
src/backend/optimizer/prep/prepjointree.c
src/backend/optimizer/prep/prepqual.c
src/backend/optimizer/prep/preptlist.c
src/backend/optimizer/util/clauses.c
src/backend/optimizer/util/orclauses.c
src/backend/optimizer/util/pathnode.c
src/backend/optimizer/util/placeholder.c
src/backend/optimizer/util/plancat.c
src/backend/optimizer/util/predtest.c
src/backend/optimizer/util/restrictinfo.c
src/backend/optimizer/util/tlist.c
src/backend/optimizer/util/var.c
src/backend/parser/analyze.c
src/backend/parser/parse_agg.c
src/backend/parser/parse_clause.c
src/backend/parser/parse_expr.c
src/backend/parser/parse_utilcmd.c
src/backend/partitioning/partbounds.c
src/backend/partitioning/partprune.c
src/backend/replication/logical/worker.c
src/backend/rewrite/rewriteManip.c
src/backend/statistics/dependencies.c
src/backend/tcop/postgres.c
src/backend/utils/adt/array_selfuncs.c
src/backend/utils/adt/orderedsetaggs.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/selfuncs.c
src/backend/utils/cache/partcache.c
src/backend/utils/cache/plancache.c
src/backend/utils/cache/relcache.c
src/backend/utils/cache/spccache.c
src/backend/utils/cache/typcache.c
src/backend/utils/misc/guc.c
src/include/nodes/relation.h
src/include/optimizer/clauses.h
src/include/optimizer/cost.h
src/include/optimizer/optimizer.h [new file with mode: 0644]
src/include/optimizer/planmain.h
src/include/optimizer/planner.h
src/include/optimizer/predtest.h [deleted file]
src/include/optimizer/prep.h
src/include/optimizer/tlist.h
src/include/optimizer/var.h [deleted file]
src/pl/plpgsql/src/pl_exec.c
src/test/modules/test_predtest/test_predtest.c

index 902d23ec4a14dd1a831b0586027da6f90c23d4c3..2d8a7f1d2638520d229fd48f8956eb3fcc5bb437 100644 (file)
@@ -13,7 +13,6 @@
 #include "postgres.h"
 
 #include "fmgr.h"
-#include "optimizer/cost.h"
 #include "utils/selfuncs.h"
 
 #include "bloom.h"
index e7db83d3fbb38135165d2ca143699b5674d5e3c4..be626bef6e639f429d75976e4d5c92ca3254979d 100644 (file)
 #include "foreign/foreign.h"
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
-#include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/planmain.h"
 #include "optimizer/restrictinfo.h"
-#include "optimizer/var.h"
 #include "utils/memutils.h"
 #include "utils/rel.h"
 #include "utils/sampling.h"
index f368d4b31fbc62199dd3b50e1f12ab5de6789658..b0e44e5562fbe68b8e3265523815ffb4756d74f4 100644 (file)
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
 #include "nodes/plannodes.h"
-#include "optimizer/clauses.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/prep.h"
 #include "optimizer/tlist.h"
-#include "optimizer/var.h"
 #include "parser/parsetree.h"
 #include "utils/builtins.h"
 #include "utils/lsyscache.h"
index 1a88919cfcad8068355d54294eb609fa4aa5c54e..7fcac81e2e4ab9b8e8e789c81fb32979ee6472f3 100644 (file)
 #include "nodes/nodeFuncs.h"
 #include "optimizer/cost.h"
 #include "optimizer/clauses.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/paths.h"
 #include "optimizer/planmain.h"
 #include "optimizer/restrictinfo.h"
-#include "optimizer/var.h"
 #include "optimizer/tlist.h"
 #include "parser/parsetree.h"
 #include "utils/builtins.h"
index 69944f61c8d211732ea3eaff08969ec380b946fb..c92490f9389e2f0a9d606ac69034730da4980254 100644 (file)
@@ -33,8 +33,7 @@
 #include "access/tsmapi.h"
 #include "catalog/pg_type.h"
 #include "miscadmin.h"
-#include "optimizer/clauses.h"
-#include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "utils/sampling.h"
 
 PG_MODULE_MAGIC;
index f516552cc02b6ba5b158c935eae39b1124b405d8..edeacf0b5392004dadab69c9002df79f7e8454f8 100644 (file)
@@ -31,8 +31,7 @@
 #include "access/tsmapi.h"
 #include "catalog/pg_type.h"
 #include "miscadmin.h"
-#include "optimizer/clauses.h"
-#include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "utils/sampling.h"
 #include "utils/spccache.h"
 
index 94463ffb9957f1711973f7d4c037f36cb3211ddd..bd142a3560dbcf8342c78a91df4743137a14ad4b 100644 (file)
@@ -22,7 +22,7 @@
 #include "access/xloginsert.h"
 #include "catalog/index.h"
 #include "miscadmin.h"
-#include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "storage/bufmgr.h"
 #include "storage/smgr.h"
 #include "utils/memutils.h"
index de147d7b68d5ebc25b00512d76cd9e3213f563fb..8e63c1fad258beb307c2db0d938c227b90a9ef54 100644 (file)
@@ -22,7 +22,6 @@
 #include "access/transam.h"
 #include "access/xact.h"
 #include "catalog/pg_amop.h"
-#include "optimizer/paths.h"
 #include "storage/bufmgr.h"
 #include "storage/indexfsm.h"
 #include "storage/lmgr.h"
@@ -32,9 +31,6 @@
 #include "utils/lsyscache.h"
 #include "utils/syscache.h"
 
-extern Expr *spgcanorderbyop(IndexOptInfo *index,
-                               PathKey *pathkey, int pathkeyno,
-                               Expr *orderby_clause, int *indexcol_p);
 
 /*
  * SP-GiST handler function: return IndexAmRoutine with access method parameters
index 5e5e32dbaecc4174bc6bef105a414a121fce5ca6..9360b5bbc99e806f79af9fe19ae872f447eb1f5e 100644 (file)
@@ -29,8 +29,7 @@
 #include "access/hash.h"
 #include "access/tsmapi.h"
 #include "catalog/pg_type.h"
-#include "optimizer/clauses.h"
-#include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "utils/builtins.h"
 
 
index 383387bc695b84ae1e375946539b944745884b08..298e0ab4a097fc5d9333edd46fbb8913835ba464 100644 (file)
@@ -31,8 +31,7 @@
 #include "access/relscan.h"
 #include "access/tsmapi.h"
 #include "catalog/pg_type.h"
-#include "optimizer/clauses.h"
-#include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "utils/builtins.h"
 
 
index 9c55c20d6b201839189ca50b4dfcca0860df36ed..ce2b61631db56e481a2d819ec94ad5f05a7ef1b5 100644 (file)
@@ -28,7 +28,7 @@
 #include "libpq/pqformat.h"
 #include "libpq/pqmq.h"
 #include "miscadmin.h"
-#include "optimizer/planmain.h"
+#include "optimizer/optimizer.h"
 #include "pgstat.h"
 #include "storage/ipc.h"
 #include "storage/sinval.h"
index cc865de627d7ffab80855fd349db84c3234e1a31..910f651522715c1985bcfa91064664cdd608473a 100644 (file)
@@ -64,9 +64,7 @@
 #include "executor/executor.h"
 #include "miscadmin.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/clauses.h"
-#include "optimizer/var.h"
-#include "optimizer/planner.h"
+#include "optimizer/optimizer.h"
 #include "parser/parse_coerce.h"
 #include "parser/parse_collate.h"
 #include "parser/parse_expr.h"
index 225c07801848d5d022be068504820c8f54e176ff..169b2de6cfbe96d7413c0693c52f83c3d293d1a7 100644 (file)
@@ -56,8 +56,7 @@
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/clauses.h"
-#include "optimizer/planner.h"
+#include "optimizer/optimizer.h"
 #include "parser/parser.h"
 #include "rewrite/rewriteManip.h"
 #include "storage/bufmgr.h"
index 62d1ec60ba57aef84eb4680ccb0fb60babc7af63..0d3bc3a2c796aa5985eb604a0290cbf2ea87929a 100644 (file)
@@ -24,9 +24,7 @@
 #include "catalog/pg_inherits.h"
 #include "catalog/pg_partitioned_table.h"
 #include "nodes/makefuncs.h"
-#include "optimizer/clauses.h"
-#include "optimizer/prep.h"
-#include "optimizer/var.h"
+#include "optimizer/optimizer.h"
 #include "partitioning/partbounds.h"
 #include "rewrite/rewriteManip.h"
 #include "utils/fmgroids.h"
index ec1d6b6f119d8128621b2f3625ea7b403909752a..a74af4c171612f0567f458cc31ae0f9eaef43127 100644 (file)
@@ -38,7 +38,7 @@
 #include "commands/tablecmds.h"
 #include "commands/vacuum.h"
 #include "miscadmin.h"
-#include "optimizer/planner.h"
+#include "optimizer/optimizer.h"
 #include "storage/bufmgr.h"
 #include "storage/lmgr.h"
 #include "storage/predicate.h"
index 4411b19e5873d749a165340042ad74a1db7a95ed..dbb06397e6bda4033a2d273e2603ee52da365a97 100644 (file)
@@ -37,9 +37,7 @@
 #include "libpq/pqformat.h"
 #include "mb/pg_wchar.h"
 #include "miscadmin.h"
-#include "optimizer/clauses.h"
-#include "optimizer/planner.h"
-#include "optimizer/prep.h"
+#include "optimizer/optimizer.h"
 #include "nodes/makefuncs.h"
 #include "parser/parse_coerce.h"
 #include "parser/parse_collate.h"
index 5d859b7c99e48d6012277628dc4cc297ccb31a86..1831ea81cfe7991b01b8e564567d9a3f0b6d498e 100644 (file)
@@ -24,8 +24,6 @@
 #include "nodes/extensible.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/clauses.h"
-#include "optimizer/planmain.h"
 #include "parser/parsetree.h"
 #include "rewrite/rewriteHandler.h"
 #include "storage/bufmgr.h"
index ac401689c82f940b6de34639020b2ff9ae8e74a9..9a2f1a85b47a693d7cc6f2e8c0989980024c029f 100644 (file)
@@ -54,8 +54,7 @@
 #include "executor/executor.h"
 #include "funcapi.h"
 #include "miscadmin.h"
-#include "optimizer/clauses.h"
-#include "optimizer/var.h"
+#include "optimizer/optimizer.h"
 #include "parser/parse_coerce.h"
 #include "parser/parse_collate.h"
 #include "parser/parse_expr.h"
index 5b2b8d2969494c9a763bd5b6832cd07c66d9abdb..bd85099c28624a82265411cafaf0c52e71766ce2 100644 (file)
@@ -42,9 +42,7 @@
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/clauses.h"
-#include "optimizer/planner.h"
-#include "optimizer/var.h"
+#include "optimizer/optimizer.h"
 #include "parser/parse_coerce.h"
 #include "parser/parse_func.h"
 #include "parser/parse_oper.h"
index ff76499137979255ab4f2091fd273fdfd13b37dc..434be403fe8019d926cdd72baa5c438d8aa0d212 100644 (file)
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
 #include "nodes/parsenodes.h"
-#include "optimizer/clauses.h"
-#include "optimizer/planner.h"
-#include "optimizer/predtest.h"
-#include "optimizer/prep.h"
-#include "optimizer/var.h"
+#include "optimizer/optimizer.h"
 #include "parser/parse_clause.h"
 #include "parser/parse_coerce.h"
 #include "parser/parse_collate.h"
index 499030c4455372f69cf9ae9894e55f3462f943f4..7b5896b98f9b1b0155aec74c31eb985a9dd38931 100644 (file)
@@ -36,8 +36,7 @@
 #include "miscadmin.h"
 #include "nodes/bitmapset.h"
 #include "nodes/makefuncs.h"
-#include "optimizer/clauses.h"
-#include "optimizer/var.h"
+#include "optimizer/optimizer.h"
 #include "parser/parse_clause.h"
 #include "parser/parse_collate.h"
 #include "parser/parse_func.h"
index 35a6485118fb2e77fdcb1c197d8d6ce0037b3336..fa7161ef9d92c6d180edb9da726cf488aff27097 100644 (file)
@@ -56,7 +56,7 @@
 #include "executor/executor.h"
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
-#include "optimizer/var.h"
+#include "optimizer/optimizer.h"
 #include "parser/parse_coerce.h"
 #include "parser/parse_collate.h"
 #include "parser/parse_expr.h"
index 2e061a5ee36f0010d8167f701035ac3ffa832e6b..e52b8063728d8318f0aa76d39c22e3c0f464f772 100644 (file)
@@ -40,8 +40,7 @@
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/clauses.h"
-#include "optimizer/planner.h"
+#include "optimizer/optimizer.h"
 #include "pgstat.h"
 #include "utils/builtins.h"
 #include "utils/datum.h"
index 5975c5206b88adb1ef0aee344de7e5de2f0f7a85..9a20460e762678e27d95dd9a9f9a53931a98413e 100644 (file)
@@ -52,7 +52,6 @@
 #include "jit/jit.h"
 #include "mb/pg_wchar.h"
 #include "miscadmin.h"
-#include "optimizer/clauses.h"
 #include "parser/parsetree.h"
 #include "rewrite/rewriteManip.h"
 #include "storage/bufmgr.h"
index ceea3d6d721cb4b726d7e9098e23bee629884c85..b79be91655b19404d4ba40b9ad815cb222281fa0 100644 (file)
@@ -39,8 +39,6 @@
 #include "executor/tqueue.h"
 #include "jit/jit.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/planmain.h"
-#include "optimizer/planner.h"
 #include "storage/spin.h"
 #include "tcop/tcopprot.h"
 #include "utils/datum.h"
index 2a260a71f241329408077137e91e902b65b67e81..263a0f812791f488774cec1bd69418868891670e 100644 (file)
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/clauses.h"
-#include "optimizer/tlist.h"
+#include "optimizer/optimizer.h"
 #include "parser/parse_agg.h"
 #include "parser/parse_coerce.h"
 #include "utils/acl.h"
index 70a4e90a05d9d156392ebedab1131b53f9fc0064..69d5a1f2398124b55e75c93b11a417648e5ecf38 100644 (file)
@@ -38,7 +38,7 @@
 #include "executor/nodeSubplan.h"
 #include "executor/tqueue.h"
 #include "miscadmin.h"
-#include "optimizer/planmain.h"
+#include "optimizer/optimizer.h"
 #include "pgstat.h"
 #include "utils/memutils.h"
 #include "utils/rel.h"
index 8635865d1e66f2f9da1988954ad9278967192344..4de1d2b484d300714acaef638583b26a9a1c31a2 100644 (file)
@@ -23,7 +23,7 @@
 #include "executor/tqueue.h"
 #include "lib/binaryheap.h"
 #include "miscadmin.h"
-#include "optimizer/planmain.h"
+#include "optimizer/optimizer.h"
 #include "utils/memutils.h"
 #include "utils/rel.h"
 
index cdf1ad09de341ac74011b4db4146e057fab8269f..324356ec7579cdbf13b66f7610d0141e52617a40 100644 (file)
@@ -37,7 +37,6 @@
 #include "lib/pairingheap.h"
 #include "miscadmin.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/clauses.h"
 #include "utils/array.h"
 #include "utils/datum.h"
 #include "utils/lsyscache.h"
index 731391f1907b30b127c6030e83e97b5afde74106..157ac042b82a4ba648291ac8b4f677231ad24181 100644 (file)
@@ -41,7 +41,7 @@
 #include "executor/nodeWindowAgg.h"
 #include "miscadmin.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/clauses.h"
+#include "optimizer/optimizer.h"
 #include "parser/parse_agg.h"
 #include "parser/parse_coerce.h"
 #include "utils/acl.h"
index 351f6ec7e1a61c1a37ec4d28082240fa8d23cb6a..df7e620da71822351b025cd58844abab7d74823b 100644 (file)
@@ -33,7 +33,6 @@
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/planner.h"
 #include "parser/parse_coerce.h"
 #include "parser/parsetree.h"
 #include "pgstat.h"
index 0d8a3f9592c08af6f59420af82051fc33811829e..2144e14ec8d667868be64b5d179a7e6fd38d9833 100644 (file)
 #include "optimizer/cost.h"
 #include "optimizer/geqo.h"
 #include "optimizer/inherit.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/paths.h"
 #include "optimizer/plancat.h"
 #include "optimizer/planner.h"
 #include "optimizer/restrictinfo.h"
 #include "optimizer/tlist.h"
-#include "optimizer/var.h"
 #include "parser/parse_clause.h"
 #include "parser/parsetree.h"
 #include "partitioning/partprune.h"
index 50452706ed163a11f91ad460adf32150c47cd4ac..abca03b805e0fe8cf408be54273f5d60c29a489c 100644 (file)
@@ -18,6 +18,7 @@
 #include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
 #include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/plancat.h"
 #include "utils/fmgroids.h"
index 19be1f375c5f3707a815b2dd448b87875b9e9acd..532de4484fad2085b8684ca6dde156b5001226ba 100644 (file)
@@ -83,6 +83,7 @@
 #include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
 #include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/paths.h"
 #include "optimizer/placeholder.h"
index 6e134ae1d26091bd90673a0b726893494ae841a4..3454f1291224119891c96c22d862968931bfeed7 100644 (file)
 #include "nodes/nodeFuncs.h"
 #include "optimizer/appendinfo.h"
 #include "optimizer/clauses.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/paths.h"
 #include "optimizer/planmain.h"
 #include "optimizer/restrictinfo.h"
-#include "optimizer/var.h"
 #include "utils/lsyscache.h"
 
 
index be50d56b5a982163817c73f15ff95ea58ae9f3a5..7e1a3908f120f68145eacfa61a07193cbd078f36 100644 (file)
 #include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
 #include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/paths.h"
-#include "optimizer/predtest.h"
 #include "optimizer/prep.h"
 #include "optimizer/restrictinfo.h"
-#include "optimizer/var.h"
 #include "utils/builtins.h"
 #include "utils/bytea.h"
 #include "utils/lsyscache.h"
index 9dac50ea390b6d0ed81ce0069138f1cae261ea02..56d839bb31c6bfea8552c77d1d5935e3e8b8dc08 100644 (file)
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
 #include "nodes/plannodes.h"
-#include "optimizer/clauses.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/paths.h"
-#include "optimizer/tlist.h"
 #include "utils/lsyscache.h"
 
 
index 94c88bd66225e2e206fe2af14bd7fa212d036870..466e99601190291d360d79fd6b22fe1f2ae8733e 100644 (file)
 #include "catalog/pg_type.h"
 #include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/paths.h"
 #include "optimizer/restrictinfo.h"
-#include "optimizer/var.h"
 
 
 /*
index 1593dbec214c88a379a97ae2ff6180aaa345cd87..a4efa693ea762dfac950fbbc603e7ed0fede5a35 100644 (file)
 #include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
 #include "optimizer/joininfo.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/paths.h"
 #include "optimizer/planmain.h"
 #include "optimizer/tlist.h"
-#include "optimizer/var.h"
 #include "utils/lsyscache.h"
 
 /* local functions */
index c1aa0ba663b3b198973c706d1080c2f485635a59..1b4f7db649ef26df929cc7f9db1a1846608fe253 100644 (file)
 #include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
 #include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/paramassign.h"
 #include "optimizer/paths.h"
 #include "optimizer/placeholder.h"
 #include "optimizer/plancat.h"
 #include "optimizer/planmain.h"
-#include "optimizer/predtest.h"
 #include "optimizer/restrictinfo.h"
 #include "optimizer/subselect.h"
 #include "optimizer/tlist.h"
-#include "optimizer/var.h"
 #include "parser/parse_clause.h"
 #include "parser/parsetree.h"
 #include "partitioning/partprune.h"
index a2376d2ed7ebeca6226cb1de895fb4d077864123..d6ffa7869d1d66478fe88ab939b44f7aaa28bcd1 100644 (file)
@@ -21,6 +21,7 @@
 #include "optimizer/clauses.h"
 #include "optimizer/cost.h"
 #include "optimizer/joininfo.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/paths.h"
 #include "optimizer/placeholder.h"
@@ -28,7 +29,6 @@
 #include "optimizer/planner.h"
 #include "optimizer/prep.h"
 #include "optimizer/restrictinfo.h"
-#include "optimizer/var.h"
 #include "parser/analyze.h"
 #include "rewrite/rewriteManip.h"
 #include "utils/lsyscache.h"
index d98cb899840a6ff66e0068a8591d3111fa514add..86617099df03749dbb851b8dd6fff02062fa6727 100644 (file)
@@ -35,6 +35,7 @@
 #include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
 #include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/paths.h"
 #include "optimizer/planmain.h"
index f9f4b12db711a5383ada1e0683bd834863a4e948..3cedd01c98b4010a363be493202e52fd84ede504 100644 (file)
@@ -23,6 +23,7 @@
 #include "optimizer/appendinfo.h"
 #include "optimizer/clauses.h"
 #include "optimizer/inherit.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/orclauses.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/paths.h"
index 5db88afd893f5c6ce22f97c4e92bf6a64d4e99f1..b2239728cf907e73c0c3f063cf3a18c520ebf7c7 100644 (file)
@@ -43,6 +43,7 @@
 #include "optimizer/clauses.h"
 #include "optimizer/cost.h"
 #include "optimizer/inherit.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/paramassign.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/paths.h"
@@ -52,7 +53,6 @@
 #include "optimizer/prep.h"
 #include "optimizer/subselect.h"
 #include "optimizer/tlist.h"
-#include "optimizer/var.h"
 #include "parser/analyze.h"
 #include "parser/parsetree.h"
 #include "parser/parse_agg.h"
index 6bd3b2d1ac14fd226f70e87238b2acbdc2bca9f6..0213a376705694a753d2b13dbe88b4fede71ecf0 100644 (file)
@@ -19,6 +19,7 @@
 #include "catalog/pg_type.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/planmain.h"
 #include "optimizer/planner.h"
index 60403eef9139d7cc9fde33f80177db4ece953e7d..915c6d0cf6e29ae708d92aa0231097918dee7ad8 100644 (file)
 #include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
 #include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/paramassign.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/planmain.h"
 #include "optimizer/planner.h"
 #include "optimizer/prep.h"
 #include "optimizer/subselect.h"
-#include "optimizer/var.h"
 #include "parser/parse_relation.h"
 #include "rewrite/rewriteManip.h"
 #include "utils/builtins.h"
index 1f64004cf61962be481200adb72f5e80d04ef5ab..9e001c1bdcb5a9885210de0329d79ea317fa2fbf 100644 (file)
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/placeholder.h"
 #include "optimizer/prep.h"
 #include "optimizer/subselect.h"
 #include "optimizer/tlist.h"
-#include "optimizer/var.h"
 #include "parser/parse_relation.h"
 #include "parser/parsetree.h"
 #include "rewrite/rewriteManip.h"
index 2bd6c200cfa0737fceae9bd337dcb721cf22535a..e9a94976b73b34ade1109ed0e34f8e17510616b3 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/clauses.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/prep.h"
 #include "utils/lsyscache.h"
 
index 0e045f171afbedd2866cb80ed2f7c24ecbdeafc1..5392d1a561ed84a355033a6bc1091faafe589430 100644 (file)
@@ -44,9 +44,9 @@
 #include "access/table.h"
 #include "catalog/pg_type.h"
 #include "nodes/makefuncs.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/prep.h"
 #include "optimizer/tlist.h"
-#include "optimizer/var.h"
 #include "parser/parsetree.h"
 #include "parser/parse_coerce.h"
 #include "rewrite/rewriteHandler.h"
index 99616063f45654046e74d2dcfb3c6c4f9f93f33e..86c346bc389a06569684e0be2bb64addc648c3ab 100644 (file)
@@ -34,9 +34,9 @@
 #include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
 #include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/planmain.h"
 #include "optimizer/prep.h"
-#include "optimizer/var.h"
 #include "parser/analyze.h"
 #include "parser/parse_agg.h"
 #include "parser/parse_coerce.h"
index c62ba88d1b29745d90e4c4bc6819cff5e8bc080b..b67158154e93c9d9104834c101139c422c85ed87 100644 (file)
@@ -19,6 +19,7 @@
 #include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
 #include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/orclauses.h"
 #include "optimizer/restrictinfo.h"
 
index 0402ffe9a7478ae28ee1fd7e6d011017290ff7e4..b57de6b4c67c060bfd991dfd36d5158f429222bd 100644 (file)
 #include "optimizer/appendinfo.h"
 #include "optimizer/clauses.h"
 #include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/paths.h"
 #include "optimizer/planmain.h"
 #include "optimizer/prep.h"
 #include "optimizer/restrictinfo.h"
 #include "optimizer/tlist.h"
-#include "optimizer/var.h"
 #include "parser/parsetree.h"
 #include "utils/lsyscache.h"
 #include "utils/memutils.h"
index b24478ec6f2c2685e104e5c999d5468469c0b37b..798aa8c59784f92d8858a749e88d61449d8d8861 100644 (file)
 
 #include "nodes/nodeFuncs.h"
 #include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/placeholder.h"
 #include "optimizer/planmain.h"
-#include "optimizer/var.h"
 #include "utils/lsyscache.h"
 
 /* Local functions */
index 243344a011055edb1e5d512a211d3e81dfd3323b..3efa1bdc1a4dd783ec90f8f42e4fbdf62e11da76 100644 (file)
@@ -35,8 +35,8 @@
 #include "nodes/makefuncs.h"
 #include "optimizer/clauses.h"
 #include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/plancat.h"
-#include "optimizer/predtest.h"
 #include "optimizer/prep.h"
 #include "partitioning/partbounds.h"
 #include "parser/parse_relation.h"
index ecbb0db18c3a9e5a930de548c51dffdd279937f0..3b260b1e3c418ccc5f0dd9c7ba8d0959795bf691 100644 (file)
@@ -21,8 +21,8 @@
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/clauses.h"
-#include "optimizer/predtest.h"
+#include "nodes/relation.h"
+#include "optimizer/optimizer.h"
 #include "utils/array.h"
 #include "utils/inval.h"
 #include "utils/lsyscache.h"
index c1bda812c70ea8b07e2206674694be33e1be2cac..1c47c7080284837fdd8600cdde96ea22563e1cb9 100644 (file)
@@ -17,8 +17,8 @@
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/restrictinfo.h"
-#include "optimizer/var.h"
 
 
 static RestrictInfo *make_restrictinfo_internal(Expr *clause,
index d0cc14f11d7c7bfa86adba03c9f397f29f0b3f3c..14d1c67a940c837fdb1b0d01f0098884b39959c4 100644 (file)
@@ -17,6 +17,7 @@
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
 #include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/tlist.h"
 
 
index 5116d7f3490b7eb28ce91dd07611b3b2e5f01ca5..315c81eb8e6adf16619610d6da156c09dea7d1bc 100644 (file)
@@ -22,8 +22,8 @@
 
 #include "access/sysattr.h"
 #include "nodes/nodeFuncs.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/prep.h"
-#include "optimizer/var.h"
 #include "parser/parsetree.h"
 #include "rewrite/rewriteManip.h"
 
index 1ef7c8608ad4a1f57b9307127ba63e1406613fdd..125ee5d84b245103f4b906adce1b0a45f27f85d8 100644 (file)
@@ -29,7 +29,7 @@
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/var.h"
+#include "optimizer/optimizer.h"
 #include "parser/analyze.h"
 #include "parser/parse_agg.h"
 #include "parser/parse_clause.h"
index 5b73378a19c72c9c47ba163bf0c888c58746450b..183ea0f2c4a33e8fea263223900763a3a3a3edff 100644 (file)
@@ -19,8 +19,7 @@
 #include "catalog/pg_type.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/tlist.h"
-#include "optimizer/var.h"
+#include "optimizer/optimizer.h"
 #include "parser/parse_agg.h"
 #include "parser/parse_clause.h"
 #include "parser/parse_coerce.h"
index 8805543da749a1036b51880f0e4b590532ca8cf1..c6ce1011e2d4a307b15a8a2d80d8fc598dc47464 100644 (file)
@@ -31,8 +31,7 @@
 #include "commands/defrem.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/tlist.h"
-#include "optimizer/var.h"
+#include "optimizer/optimizer.h"
 #include "parser/analyze.h"
 #include "parser/parsetree.h"
 #include "parser/parser.h"
index 3e0a762c41e69697b2241890f848dd35878de9d9..7fc8d63ff0e4dd7a51603258e011c68ebf81bba3 100644 (file)
@@ -20,8 +20,7 @@
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/tlist.h"
-#include "optimizer/var.h"
+#include "optimizer/optimizer.h"
 #include "parser/analyze.h"
 #include "parser/parse_clause.h"
 #include "parser/parse_coerce.h"
index 445e81a1afb75632924021719c8e0ef7d8957c8c..a37d1f18bea4f4a6fe5f3302bdf383a59e8c6b79 100644 (file)
@@ -50,9 +50,7 @@
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/clauses.h"
-#include "optimizer/planner.h"
-#include "optimizer/var.h"
+#include "optimizer/optimizer.h"
 #include "parser/analyze.h"
 #include "parser/parse_clause.h"
 #include "parser/parse_coerce.h"
index f21c9b32a6069042cc8298612be6420c0f55ba1e..d478ae7e19b21a135002cfc1466de3a0c1ed9666 100644 (file)
@@ -22,7 +22,6 @@
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/clauses.h"
 #include "parser/parse_coerce.h"
 #include "partitioning/partprune.h"
 #include "partitioning/partbounds.h"
index f5155fe062eeecbd9575e79e4b529fc09f3da53a..8c9721935d72c48bdac72960111bb3b308b7cf8e 100644 (file)
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
 #include "optimizer/appendinfo.h"
-#include "optimizer/clauses.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
-#include "optimizer/planner.h"
-#include "optimizer/predtest.h"
-#include "optimizer/prep.h"
-#include "optimizer/var.h"
 #include "partitioning/partprune.h"
 #include "partitioning/partbounds.h"
 #include "rewrite/rewriteManip.h"
index 2c49c711e361de9bd50dae8a8fdd80279c32e0fa..f9516515bc4783bc5a6b9a55d8944b946422fa18 100644 (file)
 
 #include "postgres.h"
 
-#include "miscadmin.h"
-#include "pgstat.h"
-#include "funcapi.h"
-
 #include "access/table.h"
 #include "access/xact.h"
 #include "access/xlog_internal.h"
-
 #include "catalog/catalog.h"
 #include "catalog/namespace.h"
 #include "catalog/pg_subscription.h"
 #include "catalog/pg_subscription_rel.h"
-
 #include "commands/tablecmds.h"
 #include "commands/trigger.h"
-
 #include "executor/executor.h"
 #include "executor/nodeModifyTable.h"
-
+#include "funcapi.h"
 #include "libpq/pqformat.h"
 #include "libpq/pqsignal.h"
-
 #include "mb/pg_wchar.h"
-
+#include "miscadmin.h"
 #include "nodes/makefuncs.h"
-
-#include "optimizer/planner.h"
-
+#include "optimizer/optimizer.h"
 #include "parser/parse_relation.h"
-
+#include "pgstat.h"
 #include "postmaster/bgworker.h"
 #include "postmaster/postmaster.h"
 #include "postmaster/walwriter.h"
-
 #include "replication/decode.h"
 #include "replication/logical.h"
 #include "replication/logicalproto.h"
 #include "replication/logicalrelation.h"
 #include "replication/logicalworker.h"
-#include "replication/reorderbuffer.h"
 #include "replication/origin.h"
+#include "replication/reorderbuffer.h"
 #include "replication/snapbuild.h"
 #include "replication/walreceiver.h"
 #include "replication/worker_internal.h"
-
 #include "rewrite/rewriteHandler.h"
-
 #include "storage/bufmgr.h"
 #include "storage/ipc.h"
 #include "storage/lmgr.h"
 #include "storage/proc.h"
 #include "storage/procarray.h"
-
 #include "tcop/tcopprot.h"
-
 #include "utils/builtins.h"
 #include "utils/catcache.h"
 #include "utils/datum.h"
@@ -87,8 +72,8 @@
 #include "utils/lsyscache.h"
 #include "utils/memutils.h"
 #include "utils/rel.h"
-#include "utils/timeout.h"
 #include "utils/syscache.h"
+#include "utils/timeout.h"
 
 #define NAPTIME_PER_CYCLE 1000 /* max sleep time between cycles (1s) */
 
index fd7a751c9a80cb102671066740223b2bbe2b937e..57aee3d760ca5a71bb22fc07ffcaf811a573e28c 100644 (file)
@@ -17,7 +17,7 @@
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
 #include "nodes/plannodes.h"
-#include "optimizer/clauses.h"
+#include "nodes/relation.h"
 #include "parser/parse_coerce.h"
 #include "parser/parse_relation.h"
 #include "parser/parsetree.h"
index a8e9f7221409d9216d69cca53479f87082e136dc..13492ceb9cedb73e28fce55770a940bec4e671b1 100644 (file)
@@ -20,8 +20,7 @@
 #include "lib/stringinfo.h"
 #include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
-#include "optimizer/cost.h"
-#include "optimizer/var.h"
+#include "optimizer/optimizer.h"
 #include "nodes/nodes.h"
 #include "nodes/relation.h"
 #include "statistics/extended_stats_internal.h"
index e773f20d9fee99661c6354e5164f3ae3cf9bd5d1..36cfd507b2efbe7c58c14a6b6e97a357f2a9219a 100644 (file)
@@ -49,7 +49,7 @@
 #include "libpq/pqsignal.h"
 #include "miscadmin.h"
 #include "nodes/print.h"
-#include "optimizer/planner.h"
+#include "optimizer/optimizer.h"
 #include "pgstat.h"
 #include "pg_trace.h"
 #include "parser/analyze.h"
index ad1201a8d20ecdc78cdeca98244325b0233d95cf..870131b07388a949bfe4972b96bd52e8eac4fd4f 100644 (file)
@@ -20,7 +20,6 @@
 #include "catalog/pg_collation.h"
 #include "catalog/pg_operator.h"
 #include "catalog/pg_statistic.h"
-#include "optimizer/clauses.h"
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/lsyscache.h"
index 6075bc3db7e3955cecf428be8b9c233c85f54fb3..2d384a99447c93f45682822881dab6b5fb047f42 100644 (file)
@@ -22,7 +22,7 @@
 #include "executor/executor.h"
 #include "miscadmin.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/tlist.h"
+#include "optimizer/optimizer.h"
 #include "utils/array.h"
 #include "utils/builtins.h"
 #include "utils/lsyscache.h"
index 063156773909f4803305fed15dfbcdfb839c6415..51e4c275ab0d4e21652c0bd69584a0702df01e82 100644 (file)
@@ -49,7 +49,7 @@
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/tlist.h"
+#include "optimizer/optimizer.h"
 #include "parser/parse_node.h"
 #include "parser/parse_agg.h"
 #include "parser/parse_func.h"
index 4af8c80848d9d48865cba384dcf7f3d127593117..fb00504676656da09b7b09bf93cf9883c3a7835d 100644 (file)
 #include "nodes/nodeFuncs.h"
 #include "optimizer/clauses.h"
 #include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/pathnode.h"
 #include "optimizer/paths.h"
 #include "optimizer/plancat.h"
-#include "optimizer/predtest.h"
 #include "optimizer/restrictinfo.h"
-#include "optimizer/var.h"
 #include "parser/parse_clause.h"
 #include "parser/parse_coerce.h"
 #include "parser/parsetree.h"
index 2404073bc865e0b4e68c435bcc800f0a72e70496..1b50f283c554352f1508b94318698f403bc23e8c 100644 (file)
@@ -25,8 +25,7 @@
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/clauses.h"
-#include "optimizer/planner.h"
+#include "optimizer/optimizer.h"
 #include "partitioning/partbounds.h"
 #include "utils/builtins.h"
 #include "utils/datum.h"
index 3f46b5dfb23a84ed6907599fdbead30b3ba5c6be..9851bd43d5c4c49fdfbf4cf435f820613a470592 100644 (file)
 #include "executor/executor.h"
 #include "miscadmin.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/cost.h"
-#include "optimizer/planmain.h"
-#include "optimizer/planner.h"
-#include "optimizer/prep.h"
+#include "optimizer/optimizer.h"
 #include "parser/analyze.h"
 #include "parser/parsetree.h"
 #include "storage/lmgr.h"
index 12bba1b63a035b031c81dd3c9f4f0e624a752169..af96a033385cacf4da18ace3cdcaeb8fd8b571fd 100644 (file)
@@ -71,9 +71,7 @@
 #include "miscadmin.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/clauses.h"
-#include "optimizer/prep.h"
-#include "optimizer/var.h"
+#include "optimizer/optimizer.h"
 #include "partitioning/partbounds.h"
 #include "rewrite/rewriteDefine.h"
 #include "rewrite/rowsecurity.h"
index 1d0c16bf481920ab4543a5f7e5ca6aee357679e8..6309a017c180e8627f5a25e9e0a6a4dc49076310 100644 (file)
@@ -22,7 +22,7 @@
 #include "catalog/pg_tablespace.h"
 #include "commands/tablespace.h"
 #include "miscadmin.h"
-#include "optimizer/cost.h"
+#include "optimizer/optimizer.h"
 #include "storage/bufmgr.h"
 #include "utils/catcache.h"
 #include "utils/hsearch.h"
index 2fb7dd3b8e3080fd3576e2f7eb0a0f02c93e8bb4..7857424c2c10183766a23251f689ac32e55ce38c 100644 (file)
@@ -59,7 +59,7 @@
 #include "commands/defrem.h"
 #include "executor/executor.h"
 #include "lib/dshash.h"
-#include "optimizer/planner.h"
+#include "optimizer/optimizer.h"
 #include "storage/lwlock.h"
 #include "utils/builtins.h"
 #include "utils/catcache.h"
index c216ed0922a5b2300218a0f7b741b544a7dda7ad..98d75be292942b924129f35f121f752340059ecd 100644 (file)
@@ -50,6 +50,7 @@
 #include "miscadmin.h"
 #include "optimizer/cost.h"
 #include "optimizer/geqo.h"
+#include "optimizer/optimizer.h"
 #include "optimizer/paths.h"
 #include "optimizer/planmain.h"
 #include "parser/parse_expr.h"
index 420ca05c30aca5bf70fcf890ca294a8c1e5046d5..7917b889aebf6593b668fbef1b9206fa70097fe8 100644 (file)
@@ -159,11 +159,17 @@ typedef struct PlannerGlobal
  * It holds links to all of the planner's working state, in addition to the
  * original Query.  Note that at present the planner extensively modifies
  * the passed-in Query data structure; someday that should stop.
+ *
+ * For reasons explained in optimizer/optimizer.h, we define the typedef
+ * either here or in that header, whichever is read first.
  *----------
  */
-struct AppendRelInfo;
+#ifndef HAVE_PLANNERINFO_TYPEDEF
+typedef struct PlannerInfo PlannerInfo;
+#define HAVE_PLANNERINFO_TYPEDEF 1
+#endif
 
-typedef struct PlannerInfo
+struct PlannerInfo
 {
        NodeTag         type;
 
@@ -173,7 +179,7 @@ typedef struct PlannerInfo
 
        Index           query_level;    /* 1 at the outermost Query */
 
-       struct PlannerInfo *parent_root;        /* NULL at outermost Query */
+       PlannerInfo *parent_root;       /* NULL at outermost Query */
 
        /*
         * plan_params contains the expressions that this query level needs to
@@ -342,7 +348,7 @@ typedef struct PlannerInfo
 
        /* Does this query modify any partition key columns? */
        bool            partColsUpdated;
-} PlannerInfo;
+};
 
 
 /*
@@ -2065,8 +2071,12 @@ typedef struct PlaceHolderVar
  * plain innerjoin semantics.  Note that lhs_strict, delay_upper_joins, and
  * of course the semi_xxx fields are not set meaningfully within such structs.
  */
+#ifndef HAVE_SPECIALJOININFO_TYPEDEF
+typedef struct SpecialJoinInfo SpecialJoinInfo;
+#define HAVE_SPECIALJOININFO_TYPEDEF 1
+#endif
 
-typedef struct SpecialJoinInfo
+struct SpecialJoinInfo
 {
        NodeTag         type;
        Relids          min_lefthand;   /* base relids in minimum LHS for join */
@@ -2081,7 +2091,7 @@ typedef struct SpecialJoinInfo
        bool            semi_can_hash;  /* true if semi_operators are all hash */
        List       *semi_operators; /* OIDs of equality join operators */
        List       *semi_rhs_exprs; /* righthand-side expressions of these ops */
-} SpecialJoinInfo;
+};
 
 /*
  * Append-relation info.
index 3f5342886da8a93a960a26fe6773d47131b9521c..cfedd424ced6ce1ddbd881b8c4657938704143e8 100644 (file)
@@ -35,9 +35,6 @@ extern double expression_returns_set_rows(Node *clause);
 
 extern bool contain_subplans(Node *clause);
 
-extern bool contain_mutable_functions(Node *clause);
-extern bool contain_volatile_functions(Node *clause);
-extern bool contain_volatile_functions_not_nextval(Node *clause);
 extern char max_parallel_hazard(Query *parse);
 extern bool is_parallel_safe(PlannerInfo *root, Node *node);
 extern bool contain_nonstrict_functions(Node *clause);
@@ -56,17 +53,7 @@ extern int   NumRelids(Node *clause);
 extern void CommuteOpExpr(OpExpr *clause);
 extern void CommuteRowCompareExpr(RowCompareExpr *clause);
 
-extern Node *eval_const_expressions(PlannerInfo *root, Node *node);
-
-extern Node *estimate_expression_value(PlannerInfo *root, Node *node);
-
-extern Expr *evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod,
-                                                  Oid result_collation);
-
 extern Query *inline_set_returning_function(PlannerInfo *root,
                                                          RangeTblEntry *rte);
 
-extern List *expand_function_arguments(List *args, Oid result_type,
-                                                 HeapTuple func_tuple);
-
 #endif                                                 /* CLAUSES_H */
index 623f733d7df7aaeb1a3abf2660fd1aa5421c145b..48efbe58f7fc2265789c45deec49b22a55328b4f 100644 (file)
@@ -44,15 +44,7 @@ typedef enum
  *       routines to compute costs and sizes
  */
 
-/* parameter variables and flags */
-extern PGDLLIMPORT double seq_page_cost;
-extern PGDLLIMPORT double random_page_cost;
-extern PGDLLIMPORT double cpu_tuple_cost;
-extern PGDLLIMPORT double cpu_index_tuple_cost;
-extern PGDLLIMPORT double cpu_operator_cost;
-extern PGDLLIMPORT double parallel_tuple_cost;
-extern PGDLLIMPORT double parallel_setup_cost;
-extern PGDLLIMPORT int effective_cache_size;
+/* parameter variables and flags (see also optimizer.h) */
 extern PGDLLIMPORT Cost disable_cost;
 extern PGDLLIMPORT int max_parallel_workers_per_gather;
 extern PGDLLIMPORT bool enable_seqscan;
@@ -74,7 +66,6 @@ extern PGDLLIMPORT bool enable_parallel_hash;
 extern PGDLLIMPORT bool enable_partition_pruning;
 extern PGDLLIMPORT int constraint_exclusion;
 
-extern double clamp_row_est(double nrows);
 extern double index_pages_fetched(double tuples_fetched, BlockNumber pages,
                                        double index_pages, PlannerInfo *root);
 extern void cost_seqscan(Path *path, PlannerInfo *root, RelOptInfo *baserel,
@@ -165,6 +156,10 @@ extern void final_cost_hashjoin(PlannerInfo *root, HashPath *path,
                                        JoinPathExtraData *extra);
 extern void cost_gather(GatherPath *path, PlannerInfo *root,
                        RelOptInfo *baserel, ParamPathInfo *param_info, double *rows);
+extern void cost_gather_merge(GatherMergePath *path, PlannerInfo *root,
+                                 RelOptInfo *rel, ParamPathInfo *param_info,
+                                 Cost input_startup_cost, Cost input_total_cost,
+                                 double *rows);
 extern void cost_subplan(PlannerInfo *root, SubPlan *subplan, Plan *plan);
 extern void cost_qual_eval(QualCost *cost, List *quals, PlannerInfo *root);
 extern void cost_qual_eval_node(QualCost *cost, Node *qual, PlannerInfo *root);
@@ -204,23 +199,4 @@ extern PathTarget *set_pathtarget_cost_width(PlannerInfo *root, PathTarget *targ
 extern double compute_bitmap_pages(PlannerInfo *root, RelOptInfo *baserel,
                                         Path *bitmapqual, int loop_count, Cost *cost, double *tuple);
 
-/*
- * prototypes for clausesel.c
- *       routines to compute clause selectivities
- */
-extern Selectivity clauselist_selectivity(PlannerInfo *root,
-                                          List *clauses,
-                                          int varRelid,
-                                          JoinType jointype,
-                                          SpecialJoinInfo *sjinfo);
-extern Selectivity clause_selectivity(PlannerInfo *root,
-                                  Node *clause,
-                                  int varRelid,
-                                  JoinType jointype,
-                                  SpecialJoinInfo *sjinfo);
-extern void cost_gather_merge(GatherMergePath *path, PlannerInfo *root,
-                                 RelOptInfo *rel, ParamPathInfo *param_info,
-                                 Cost input_startup_cost, Cost input_total_cost,
-                                 double *rows);
-
 #endif                                                 /* COST_H */
diff --git a/src/include/optimizer/optimizer.h b/src/include/optimizer/optimizer.h
new file mode 100644 (file)
index 0000000..1cd5c80
--- /dev/null
@@ -0,0 +1,175 @@
+/*-------------------------------------------------------------------------
+ *
+ * optimizer.h
+ *       External API for the Postgres planner.
+ *
+ * This header is meant to define everything that the core planner
+ * exposes for use by non-planner modules.
+ *
+ * Note that there are files outside src/backend/optimizer/ that are
+ * considered planner modules, because they're too much in bed with
+ * planner operations to be treated otherwise.  FDW planning code is an
+ * example.  For the most part, however, code outside the core planner
+ * should not need to include any optimizer/ header except this one.
+ *
+ * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/optimizer/optimizer.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef OPTIMIZER_H
+#define OPTIMIZER_H
+
+#include "nodes/parsenodes.h"
+
+/*
+ * We don't want to include nodes/relation.h here, because non-planner
+ * code should generally treat PlannerInfo as an opaque typedef.
+ * But we'd like such code to use that typedef name, so define the
+ * typedef either here or in relation.h, whichever is read first.
+ */
+#ifndef HAVE_PLANNERINFO_TYPEDEF
+typedef struct PlannerInfo PlannerInfo;
+#define HAVE_PLANNERINFO_TYPEDEF 1
+#endif
+
+/* Likewise for SpecialJoinInfo. */
+#ifndef HAVE_SPECIALJOININFO_TYPEDEF
+typedef struct SpecialJoinInfo SpecialJoinInfo;
+#define HAVE_SPECIALJOININFO_TYPEDEF 1
+#endif
+
+/* It also seems best not to include plannodes.h, params.h, or htup.h here */
+struct PlannedStmt;
+struct ParamListInfoData;
+struct HeapTupleData;
+
+
+/* in path/clausesel.c: */
+
+extern Selectivity clause_selectivity(PlannerInfo *root,
+                                  Node *clause,
+                                  int varRelid,
+                                  JoinType jointype,
+                                  SpecialJoinInfo *sjinfo);
+extern Selectivity clauselist_selectivity(PlannerInfo *root,
+                                          List *clauses,
+                                          int varRelid,
+                                          JoinType jointype,
+                                          SpecialJoinInfo *sjinfo);
+
+/* in path/costsize.c: */
+
+/* widely used cost parameters */
+extern PGDLLIMPORT double seq_page_cost;
+extern PGDLLIMPORT double random_page_cost;
+extern PGDLLIMPORT double cpu_tuple_cost;
+extern PGDLLIMPORT double cpu_index_tuple_cost;
+extern PGDLLIMPORT double cpu_operator_cost;
+extern PGDLLIMPORT double parallel_tuple_cost;
+extern PGDLLIMPORT double parallel_setup_cost;
+extern PGDLLIMPORT int effective_cache_size;
+
+extern double clamp_row_est(double nrows);
+
+/* in plan/planner.c: */
+
+/* possible values for force_parallel_mode */
+typedef enum
+{
+       FORCE_PARALLEL_OFF,
+       FORCE_PARALLEL_ON,
+       FORCE_PARALLEL_REGRESS
+}                      ForceParallelMode;
+
+/* GUC parameters */
+extern int     force_parallel_mode;
+extern bool parallel_leader_participation;
+
+extern struct PlannedStmt *planner(Query *parse, int cursorOptions,
+               struct ParamListInfoData *boundParams);
+
+extern Expr *expression_planner(Expr *expr);
+extern Expr *expression_planner_with_deps(Expr *expr,
+                                                        List **relationOids,
+                                                        List **invalItems);
+
+extern bool plan_cluster_use_sort(Oid tableOid, Oid indexOid);
+extern int     plan_create_index_workers(Oid tableOid, Oid indexOid);
+
+/* in plan/setrefs.c: */
+
+extern void extract_query_dependencies(Node *query,
+                                                  List **relationOids,
+                                                  List **invalItems,
+                                                  bool *hasRowSecurity);
+
+/* in prep/prepqual.c: */
+
+extern Node *negate_clause(Node *node);
+extern Expr *canonicalize_qual(Expr *qual, bool is_check);
+
+/* in util/clauses.c: */
+
+extern bool contain_mutable_functions(Node *clause);
+extern bool contain_volatile_functions(Node *clause);
+extern bool contain_volatile_functions_not_nextval(Node *clause);
+
+extern Node *eval_const_expressions(PlannerInfo *root, Node *node);
+
+extern Node *estimate_expression_value(PlannerInfo *root, Node *node);
+
+extern Expr *evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod,
+                         Oid result_collation);
+
+extern List *expand_function_arguments(List *args, Oid result_type,
+                                                 struct HeapTupleData *func_tuple);
+
+/* in util/predtest.c: */
+
+extern bool predicate_implied_by(List *predicate_list, List *clause_list,
+                                        bool weak);
+extern bool predicate_refuted_by(List *predicate_list, List *clause_list,
+                                        bool weak);
+
+/* in util/tlist.c: */
+
+extern int     count_nonjunk_tlist_entries(List *tlist);
+extern TargetEntry *get_sortgroupref_tle(Index sortref,
+                                        List *targetList);
+extern TargetEntry *get_sortgroupclause_tle(SortGroupClause *sgClause,
+                                               List *targetList);
+extern Node *get_sortgroupclause_expr(SortGroupClause *sgClause,
+                                                List *targetList);
+extern List *get_sortgrouplist_exprs(List *sgClauses,
+                                               List *targetList);
+extern SortGroupClause *get_sortgroupref_clause(Index sortref,
+                                               List *clauses);
+extern SortGroupClause *get_sortgroupref_clause_noerr(Index sortref,
+                                                         List *clauses);
+
+/* in util/var.c: */
+
+/* Bits that can be OR'd into the flags argument of pull_var_clause() */
+#define PVC_INCLUDE_AGGREGATES 0x0001  /* include Aggrefs in output list */
+#define PVC_RECURSE_AGGREGATES 0x0002  /* recurse into Aggref arguments */
+#define PVC_INCLUDE_WINDOWFUNCS 0x0004 /* include WindowFuncs in output list */
+#define PVC_RECURSE_WINDOWFUNCS 0x0008 /* recurse into WindowFunc arguments */
+#define PVC_INCLUDE_PLACEHOLDERS       0x0010  /* include PlaceHolderVars in
+                                                                                        * output list */
+#define PVC_RECURSE_PLACEHOLDERS       0x0020  /* recurse into PlaceHolderVar
+                                                                                        * arguments */
+
+extern Bitmapset *pull_varnos(Node *node);
+extern Bitmapset *pull_varnos_of_level(Node *node, int levelsup);
+extern void pull_varattnos(Node *node, Index varno, Bitmapset **varattnos);
+extern List *pull_vars_of_level(Node *node, int levelsup);
+extern bool contain_var_clause(Node *node);
+extern bool contain_vars_of_level(Node *node, int levelsup);
+extern int     locate_var_of_level(Node *node, int levelsup);
+extern List *pull_var_clause(Node *node, int flags);
+extern Node *flatten_join_alias_vars(Query *query, Node *node);
+
+#endif                                                 /* OPTIMIZER_H */
index bec0c3861722290d28ab919412100460c9214ebe..b2e1c077320368fc55aca4b6d48ee6c2095a87e1 100644 (file)
 #include "nodes/plannodes.h"
 #include "nodes/relation.h"
 
-/* possible values for force_parallel_mode */
-typedef enum
-{
-       FORCE_PARALLEL_OFF,
-       FORCE_PARALLEL_ON,
-       FORCE_PARALLEL_REGRESS
-}                      ForceParallelMode;
-
 /* GUC parameters */
 #define DEFAULT_CURSOR_TUPLE_FRACTION 0.1
 extern double cursor_tuple_fraction;
-extern int     force_parallel_mode;
-extern bool parallel_leader_participation;
 
 /* query_planner callback to compute query_pathkeys */
 typedef void (*query_pathkeys_callback) (PlannerInfo *root, void *extra);
@@ -119,10 +109,6 @@ extern bool innerrel_is_unique(PlannerInfo *root,
 extern Plan *set_plan_references(PlannerInfo *root, Plan *plan);
 extern void record_plan_function_dependency(PlannerInfo *root, Oid funcid);
 extern void record_plan_type_dependency(PlannerInfo *root, Oid typid);
-extern void extract_query_dependencies(Node *query,
-                                                  List **relationOids,
-                                                  List **invalItems,
-                                                  bool *hasRowSecurity);
 extern bool extract_query_dependencies_walker(Node *node, PlannerInfo *root);
 
 #endif                                                 /* PLANMAIN_H */
index 8616681e0a2b5721f3532e71931306a31c64786a..769a2f8e011ce5e246246a53bea39fccafc34121 100644 (file)
@@ -3,6 +3,10 @@
  * planner.h
  *       prototypes for planner.c.
  *
+ * Note that the primary entry points for planner.c are declared in
+ * optimizer/optimizer.h, because they're intended to be called from
+ * non-planner code.  Declarations here are meant for use by other
+ * planner modules.
  *
  * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
@@ -33,8 +37,6 @@ typedef void (*create_upper_paths_hook_type) (PlannerInfo *root,
 extern PGDLLIMPORT create_upper_paths_hook_type create_upper_paths_hook;
 
 
-extern PlannedStmt *planner(Query *parse, int cursorOptions,
-               ParamListInfo boundParams);
 extern PlannedStmt *standard_planner(Query *parse, int cursorOptions,
                                 ParamListInfo boundParams);
 
@@ -54,14 +56,6 @@ extern void mark_partial_aggref(Aggref *agg, AggSplit aggsplit);
 extern Path *get_cheapest_fractional_path(RelOptInfo *rel,
                                                         double tuple_fraction);
 
-extern Expr *expression_planner(Expr *expr);
-extern Expr *expression_planner_with_deps(Expr *expr,
-                                                        List **relationOids,
-                                                        List **invalItems);
-
 extern Expr *preprocess_phv_expression(PlannerInfo *root, Expr *expr);
 
-extern bool plan_cluster_use_sort(Oid tableOid, Oid indexOid);
-extern int     plan_create_index_workers(Oid tableOid, Oid indexOid);
-
 #endif                                                 /* PLANNER_H */
diff --git a/src/include/optimizer/predtest.h b/src/include/optimizer/predtest.h
deleted file mode 100644 (file)
index d5abe79..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * predtest.h
- *       prototypes for predtest.c
- *
- *
- * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/optimizer/predtest.h
- *
- *-------------------------------------------------------------------------
- */
-#ifndef PREDTEST_H
-#define PREDTEST_H
-
-#include "nodes/primnodes.h"
-
-
-extern bool predicate_implied_by(List *predicate_list, List *clause_list,
-                                        bool weak);
-extern bool predicate_refuted_by(List *predicate_list, List *clause_list,
-                                        bool weak);
-
-#endif                                                 /* PREDTEST_H */
index 17c44c46b9d2f47427bc3cef77deb540bbacb83f..5277e990ed9c60f290d8a6f6072181d761f50d88 100644 (file)
@@ -31,12 +31,6 @@ extern void remove_useless_result_rtes(PlannerInfo *root);
 extern Relids get_relids_in_jointree(Node *jtnode, bool include_joins);
 extern Relids get_relids_for_join(Query *query, int joinrelid);
 
-/*
- * prototypes for prepqual.c
- */
-extern Node *negate_clause(Node *node);
-extern Expr *canonicalize_qual(Expr *qual, bool is_check);
-
 /*
  * prototypes for preptlist.c
  */
index 8b967f958351c73586a83d199572bac56e2490f2..13ac7b88b46223b4a5f3ae1a88356ccb5e42b55e 100644 (file)
@@ -24,8 +24,6 @@ extern List *add_to_flat_tlist(List *tlist, List *exprs);
 
 extern List *get_tlist_exprs(List *tlist, bool includeJunk);
 
-extern int     count_nonjunk_tlist_entries(List *tlist);
-
 extern bool tlist_same_exprs(List *tlist1, List *tlist2);
 
 extern bool tlist_same_datatypes(List *tlist, List *colTypes, bool junkOK);
@@ -33,20 +31,6 @@ extern bool tlist_same_collations(List *tlist, List *colCollations, bool junkOK)
 
 extern void apply_tlist_labeling(List *dest_tlist, List *src_tlist);
 
-extern TargetEntry *get_sortgroupref_tle(Index sortref,
-                                        List *targetList);
-extern TargetEntry *get_sortgroupclause_tle(SortGroupClause *sgClause,
-                                               List *targetList);
-extern Node *get_sortgroupclause_expr(SortGroupClause *sgClause,
-                                                List *targetList);
-extern List *get_sortgrouplist_exprs(List *sgClauses,
-                                               List *targetList);
-
-extern SortGroupClause *get_sortgroupref_clause(Index sortref,
-                                               List *clauses);
-extern SortGroupClause *get_sortgroupref_clause_noerr(Index sortref,
-                                                         List *clauses);
-
 extern Oid *extract_grouping_ops(List *groupClause);
 extern AttrNumber *extract_grouping_cols(List *groupClause, List *tlist);
 extern bool grouping_is_sortable(List *groupClause);
diff --git a/src/include/optimizer/var.h b/src/include/optimizer/var.h
deleted file mode 100644 (file)
index f975074..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * var.h
- *       prototypes for optimizer/util/var.c.
- *
- *
- * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * src/include/optimizer/var.h
- *
- *-------------------------------------------------------------------------
- */
-#ifndef VAR_H
-#define VAR_H
-
-#include "nodes/relation.h"
-
-/* Bits that can be OR'd into the flags argument of pull_var_clause() */
-#define PVC_INCLUDE_AGGREGATES 0x0001  /* include Aggrefs in output list */
-#define PVC_RECURSE_AGGREGATES 0x0002  /* recurse into Aggref arguments */
-#define PVC_INCLUDE_WINDOWFUNCS 0x0004 /* include WindowFuncs in output list */
-#define PVC_RECURSE_WINDOWFUNCS 0x0008 /* recurse into WindowFunc arguments */
-#define PVC_INCLUDE_PLACEHOLDERS       0x0010  /* include PlaceHolderVars in
-                                                                                        * output list */
-#define PVC_RECURSE_PLACEHOLDERS       0x0020  /* recurse into PlaceHolderVar
-                                                                                        * arguments */
-
-
-extern Relids pull_varnos(Node *node);
-extern Relids pull_varnos_of_level(Node *node, int levelsup);
-extern void pull_varattnos(Node *node, Index varno, Bitmapset **varattnos);
-extern List *pull_vars_of_level(Node *node, int levelsup);
-extern bool contain_var_clause(Node *node);
-extern bool contain_vars_of_level(Node *node, int levelsup);
-extern int     locate_var_of_level(Node *node, int levelsup);
-extern List *pull_var_clause(Node *node, int flags);
-extern Node *flatten_join_alias_vars(Query *query, Node *node);
-
-#endif                                                 /* VAR_H */
index 45f10f901b729c828ce90bb7b1a3869dc6324e35..85aa61371d6c08337c1a09103f9f8c4e351abd3c 100644 (file)
@@ -30,8 +30,7 @@
 #include "funcapi.h"
 #include "miscadmin.h"
 #include "nodes/nodeFuncs.h"
-#include "optimizer/clauses.h"
-#include "optimizer/planner.h"
+#include "optimizer/optimizer.h"
 #include "parser/parse_coerce.h"
 #include "parser/scansup.h"
 #include "storage/proc.h"
index c03748cb3c3c889f9cc5a674adea8ed0e452fc35..10cd4f9ae5a6c53539179de966132ec5246ed2b5 100644 (file)
@@ -18,8 +18,7 @@
 #include "executor/spi.h"
 #include "funcapi.h"
 #include "nodes/makefuncs.h"
-#include "optimizer/clauses.h"
-#include "optimizer/predtest.h"
+#include "optimizer/optimizer.h"
 #include "utils/builtins.h"
 
 PG_MODULE_MAGIC;