On 25.03.22 14:08, Peter Eisentraut wrote:
2. Some of these comment lines have become pretty long after having
added the attribute macro.
e.g.
PlannerInfo *subroot pg_node_attr(readwrite_ignore); /* modified
"root" for planning the subquery;
not printed, too large, not interesting enough */
I wonder if you'd be better to add a blank line above, then put the
comment on its own line, i.e:
/* modified "root" for planning the subquery; not printed, too large,
not interesting enough */
PlannerInfo *subroot pg_node_attr(readwrite_ignore);
Yes, my idea was to make a separate patch first that reformats many of
the structs and comments in that way.
Here is a patch that reformats the relevant (and a few more) comments
that way. This has been run through pgindent, so the formatting should
be stable.From 5eea69417e524779e2e3cc5164966646cb2c2c0e Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Mon, 23 May 2022 07:40:12 +0200
Subject: [PATCH] Reformat node comments
---
src/include/nodes/parsenodes.h | 3 +-
src/include/nodes/pathnodes.h | 686 ++++++++++++++++++++++-----------
src/include/nodes/plannodes.h | 423 ++++++++++++++------
src/include/nodes/primnodes.h | 166 +++++---
4 files changed, 899 insertions(+), 379 deletions(-)
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 73f635b455..f93d866548 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -123,7 +123,8 @@ typedef struct Query
QuerySource querySource; /* where did I come from? */
- uint64 queryId; /* query identifier (can be set
by plugins) */
+ /* query identifier (can be set by plugins) */
+ uint64 queryId;
bool canSetTag; /* do I set the command result
tag? */
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
index a6e5db4eec..b88cfb8dc0 100644
--- a/src/include/nodes/pathnodes.h
+++ b/src/include/nodes/pathnodes.h
@@ -226,8 +226,8 @@ struct PlannerInfo
* even when using the hash table for lookups; this simplifies life for
* GEQO.
*/
- List *join_rel_list; /* list of join-relation RelOptInfos */
- struct HTAB *join_rel_hash; /* optional hashtable for join relations */
+ List *join_rel_list;
+ struct HTAB *join_rel_hash;
/*
* When doing a dynamic-programming-style join search, join_rel_level[k]
@@ -329,11 +329,16 @@ struct PlannerInfo
*/
List *update_colnos;
- /* Fields filled during create_plan() for use in setrefs.c */
- AttrNumber *grouping_map; /* for GroupingFunc fixup */
- List *minmax_aggs; /* List of MinMaxAggInfos */
+ /*
+ * Fields filled during create_plan() for use in setrefs.c
+ */
+ /* for GroupingFunc fixup */
+ AttrNumber *grouping_map;
+ /* List of MinMaxAggInfos */
+ List *minmax_aggs;
- MemoryContext planner_cxt; /* context holding PlannerInfo */
+ /* context holding PlannerInfo */
+ MemoryContext planner_cxt;
Cardinality total_table_pages; /* # of pages in all non-dummy tables of
*
query */
@@ -369,9 +374,12 @@ struct PlannerInfo
Relids curOuterRels; /* outer rels above current node */
List *curOuterParams; /* not-yet-assigned NestLoopParams */
- /* These fields are workspace for setrefs.c */
- bool *isAltSubplan; /* array corresponding to
glob->subplans */
- bool *isUsedSubplan; /* array corresponding to
glob->subplans */
+ /*
+ * These fields are workspace for setrefs.c. Each is an array
+ * corresponding to glob->subplans.
+ */
+ bool *isAltSubplan;
+ bool *isUsedSubplan;
/* optional private data for join_search_hook, e.g., GEQO */
void *join_search_private;
@@ -678,21 +686,37 @@ typedef struct RelOptInfo
RelOptKind reloptkind;
- /* all relations included in this RelOptInfo */
- Relids relids; /* set of base relids
(rangetable indexes) */
+ /*
+ * all relations included in this RelOptInfo; set of base relids
+ * (rangetable indexes)
+ */
+ Relids relids;
- /* size estimates generated by planner */
- Cardinality rows; /* estimated number of result
tuples */
+ /*
+ * size estimates generated by planner
+ */
+ /* estimated number of result tuples */
+ Cardinality rows;
- /* per-relation planner control flags */
- bool consider_startup; /* keep cheap-startup-cost
paths? */
- bool consider_param_startup; /* ditto, for parameterized
paths? */
- bool consider_parallel; /* consider parallel paths? */
+ /*
+ * per-relation planner control flags
+ */
+ /* keep cheap-startup-cost paths? */
+ bool consider_startup;
+ /* ditto, for parameterized paths? */
+ bool consider_param_startup;
+ /* consider parallel paths? */
+ bool consider_parallel;
- /* default result targetlist for Paths scanning this relation */
- struct PathTarget *reltarget; /* list of Vars/Exprs, cost, width */
+ /*
+ * default result targetlist for Paths scanning this relation; list of
+ * Vars/Exprs, cost, width
+ */
+ struct PathTarget *reltarget;
- /* materialization information */
+ /*
+ * materialization information
+ */
List *pathlist; /* Path structures */
List *ppilist; /* ParamPathInfos used in pathlist */
List *partial_pathlist; /* partial Paths */
@@ -701,79 +725,132 @@ typedef struct RelOptInfo
struct Path *cheapest_unique_path;
List *cheapest_parameterized_paths;
- /* parameterization information needed for both base rels and join rels
*/
- /* (see also lateral_vars and lateral_referencers) */
- Relids direct_lateral_relids; /* rels directly laterally
referenced */
- Relids lateral_relids; /* minimum parameterization of rel */
+ /*
+ * parameterization information needed for both base rels and join rels
+ * (see also lateral_vars and lateral_referencers)
+ */
+ /* rels directly laterally referenced */
+ Relids direct_lateral_relids;
+ /* minimum parameterization of rel */
+ Relids lateral_relids;
- /* information about a base rel (not set for join rels!) */
+ /*
+ * information about a base rel (not set for join rels!)
+ */
Index relid;
- Oid reltablespace; /* containing tablespace */
- RTEKind rtekind; /* RELATION, SUBQUERY,
FUNCTION, etc */
- AttrNumber min_attr; /* smallest attrno of rel
(often <0) */
- AttrNumber max_attr; /* largest attrno of rel */
- Relids *attr_needed; /* array indexed [min_attr .. max_attr]
*/
- int32 *attr_widths; /* array indexed [min_attr .. max_attr]
*/
- List *lateral_vars; /* LATERAL Vars and PHVs referenced by
rel */
- Relids lateral_referencers; /* rels that reference me
laterally */
- List *indexlist; /* list of IndexOptInfo */
- List *statlist; /* list of StatisticExtInfo */
- BlockNumber pages; /* size estimates derived from
pg_class */
+ /* containing tablespace */
+ Oid reltablespace;
+ /* RELATION, SUBQUERY, FUNCTION, etc */
+ RTEKind rtekind;
+ /* smallest attrno of rel (often <0) */
+ AttrNumber min_attr;
+ /* largest attrno of rel */
+ AttrNumber max_attr;
+ /* array indexed [min_attr .. max_attr] */
+ Relids *attr_needed;
+ /* array indexed [min_attr .. max_attr] */
+ int32 *attr_widths;
+ /* LATERAL Vars and PHVs referenced by rel */
+ List *lateral_vars;
+ /* rels that reference me laterally */
+ Relids lateral_referencers;
+ /* list of IndexOptInfo */
+ List *indexlist;
+ /* list of StatisticExtInfo */
+ List *statlist;
+ /* size estimates derived from pg_class */
+ BlockNumber pages;
Cardinality tuples;
double allvisfrac;
- Bitmapset *eclass_indexes; /* Indexes in PlannerInfo's eq_classes list
of
- * ECs that
mention this rel */
+
+ /*
+ * Indexes in PlannerInfo's eq_classes list of ECs that mention this rel
+ */
+ Bitmapset *eclass_indexes;
PlannerInfo *subroot; /* if subquery */
List *subplan_params; /* if subquery */
- int rel_parallel_workers; /* wanted number of
parallel workers */
- uint32 amflags; /* Bitmask of optional features
supported by
- * the table AM
*/
-
- /* Information about foreign tables and foreign joins */
- Oid serverid; /* identifies server
for the table or join */
- Oid userid; /* identifies user to
check access as */
- bool useridiscurrent; /* join is only valid for
current user */
+ /* wanted number of parallel workers */
+ int rel_parallel_workers;
+ /* Bitmask of optional features supported by the table AM */
+ uint32 amflags;
+
+ /*
+ * Information about foreign tables and foreign joins
+ */
+ /* identifies server for the table or join */
+ Oid serverid;
+ /* identifies user to check access as */
+ Oid userid;
+ /* join is only valid for current user */
+ bool useridiscurrent;
/* use "struct FdwRoutine" to avoid including fdwapi.h here */
struct FdwRoutine *fdwroutine;
void *fdw_private;
- /* cache space for remembering if we have proven this relation unique */
- List *unique_for_rels; /* known unique for these other relid
- *
set(s) */
- List *non_unique_for_rels; /* known not unique for these
set(s) */
-
- /* used by various scans and joins: */
- List *baserestrictinfo; /* RestrictInfo structures (if base
rel) */
- QualCost baserestrictcost; /* cost of evaluating the above
*/
- Index baserestrict_min_security; /* min security_level
found in
-
* baserestrictinfo */
- List *joininfo; /* RestrictInfo structures for join
clauses
- * involving
this rel */
- bool has_eclass_joins; /* T means joininfo is
incomplete */
-
- /* used by partitionwise joins: */
- bool consider_partitionwise_join; /* consider
partitionwise join
-
* paths? (if partitioned rel) */
- Relids top_parent_relids; /* Relids of topmost parents
(if "other"
- * rel)
*/
-
- /* used for partitioned relations: */
- PartitionScheme part_scheme; /* Partitioning scheme */
- int nparts; /* Number of
partitions; -1 if not yet set; in
- * case of a
join relation 0 means it's
- * considered
unpartitioned */
- struct PartitionBoundInfoData *boundinfo; /* Partition bounds */
- bool partbounds_merged; /* True if partition bounds
were created
- * by
partition_bounds_merge() */
- List *partition_qual; /* Partition constraint, if not the root */
- struct RelOptInfo **part_rels; /* Array of RelOptInfos of partitions,
- *
stored in the same order as bounds */
- Bitmapset *live_parts; /* Bitmap with members acting as
indexes into
- * the
part_rels[] array to indicate which
- * partitions
survived partition pruning. */
- Relids all_partrels; /* Relids set of all partition relids */
- List **partexprs; /* Non-nullable partition key
expressions */
- List **nullable_partexprs; /* Nullable partition key expressions */
+ /*
+ * cache space for remembering if we have proven this relation unique
+ */
+ /* known unique for these other relid set(s) */
+ List *unique_for_rels;
+ /* known not unique for these set(s) */
+ List *non_unique_for_rels;
+
+ /*
+ * used by various scans and joins:
+ */
+ /* RestrictInfo structures (if base rel) */
+ List *baserestrictinfo;
+ /* cost of evaluating the above */
+ QualCost baserestrictcost;
+ /* min security_level found in baserestrictinfo */
+ Index baserestrict_min_security;
+ /* RestrictInfo structures for join clauses involving this rel */
+ List *joininfo;
+ /* T means joininfo is incomplete */
+ bool has_eclass_joins;
+
+ /*
+ * used by partitionwise joins:
+ */
+ /* consider partitionwise join paths? (if partitioned rel) */
+ bool consider_partitionwise_join;
+ /* Relids of topmost parents (if "other" rel) */
+ Relids top_parent_relids;
+
+ /*
+ * used for partitioned relations:
+ */
+ /* Partitioning scheme */
+ PartitionScheme part_scheme;
+
+ /*
+ * Number of partitions; -1 if not yet set; in case of a join relation 0
+ * means it's considered unpartitioned
+ */
+ int nparts;
+ /* Partition bounds */
+ struct PartitionBoundInfoData *boundinfo;
+ /* True if partition bounds were created by partition_bounds_merge() */
+ bool partbounds_merged;
+ /* Partition constraint, if not the root */
+ List *partition_qual;
+
+ /*
+ * Array of RelOptInfos of partitions, stored in the same order as
bounds
+ */
+ struct RelOptInfo **part_rels;
+
+ /*
+ * Bitmap with members acting as indexes into the part_rels[] array to
+ * indicate which partitions survived partition pruning.
+ */
+ Bitmapset *live_parts;
+ /* Relids set of all partition relids */
+ Relids all_partrels;
+ /* Non-nullable partition key expressions */
+ List **partexprs;
+ /* Nullable partition key expressions */
+ List **nullable_partexprs;
} RelOptInfo;
/*
@@ -836,56 +913,93 @@ struct IndexOptInfo
{
NodeTag type;
- Oid indexoid; /* OID of the index
relation */
- Oid reltablespace; /* tablespace of index (not
table) */
- RelOptInfo *rel; /* back-link to index's table */
-
- /* index-size statistics (from pg_class and elsewhere) */
- BlockNumber pages; /* number of disk pages in
index */
- Cardinality tuples; /* number of index tuples in
index */
- int tree_height; /* index tree height, or -1 if
unknown */
-
- /* index descriptor information */
- int ncolumns; /* number of columns in
index */
- int nkeycolumns; /* number of key columns in
index */
- int *indexkeys; /* column numbers of index's
attributes both
- * key and
included columns, or 0 */
- Oid *indexcollations; /* OIDs of collations of index
columns */
- Oid *opfamily; /* OIDs of operator families
for columns */
- Oid *opcintype; /* OIDs of opclass declared
input data types */
- Oid *sortopfamily; /* OIDs of btree opfamilies, if
orderable */
- bool *reverse_sort; /* is sort order descending? */
- bool *nulls_first; /* do NULLs come first in the sort
order? */
- bytea **opclassoptions; /* opclass-specific options for columns */
- bool *canreturn; /* which index cols can be returned in
an
- * index-only
scan? */
- Oid relam; /* OID of the access
method (in pg_am) */
-
- List *indexprs; /* expressions for non-simple index
columns */
- List *indpred; /* predicate if a partial index, else
NIL */
-
- List *indextlist; /* targetlist representing index
columns */
-
- List *indrestrictinfo; /* parent relation's baserestrictinfo
- *
list, less any conditions implied by
- * the
index's predicate (unless it's a
- *
target rel, see comments in
- *
check_index_predicates()) */
-
- bool predOK; /* true if index predicate
matches query */
- bool unique; /* true if a unique index */
- bool immediate; /* is uniqueness enforced
immediately? */
- bool hypothetical; /* true if index doesn't really exist */
-
- /* Remaining fields are copied from the index AM's API struct: */
- bool amcanorderbyop; /* does AM support order by operator
result? */
- bool amoptionalkey; /* can query omit key for the first
column? */
- bool amsearcharray; /* can AM handle ScalarArrayOpExpr
quals? */
- bool amsearchnulls; /* can AM search for NULL/NOT NULL
entries? */
- bool amhasgettuple; /* does AM have amgettuple interface? */
- bool amhasgetbitmap; /* does AM have amgetbitmap interface?
*/
- bool amcanparallel; /* does AM support parallel scan? */
- bool amcanmarkpos; /* does AM support mark/restore? */
+ /* OID of the index relation */
+ Oid indexoid;
+ /* tablespace of index (not table) */
+ Oid reltablespace;
+ /* back-link to index's table */
+ RelOptInfo *rel;
+
+ /*
+ * index-size statistics (from pg_class and elsewhere)
+ */
+ /* number of disk pages in index */
+ BlockNumber pages;
+ /* number of index tuples in index */
+ Cardinality tuples;
+ /* index tree height, or -1 if unknown */
+ int tree_height;
+
+ /*
+ * index descriptor information
+ */
+ /* number of columns in index */
+ int ncolumns;
+ /* number of key columns in index */
+ int nkeycolumns;
+
+ /*
+ * column numbers of index's attributes both key and included columns,
or
+ * 0
+ */
+ int *indexkeys;
+ /* OIDs of collations of index columns */
+ Oid *indexcollations;
+ /* OIDs of operator families for columns */
+ Oid *opfamily;
+ /* OIDs of opclass declared input data types */
+ Oid *opcintype;
+ /* OIDs of btree opfamilies, if orderable */
+ Oid *sortopfamily;
+ /* is sort order descending? */
+ bool *reverse_sort;
+ /* do NULLs come first in the sort order? */
+ bool *nulls_first;
+ /* opclass-specific options for columns */
+ bytea **opclassoptions;
+ /* which index cols can be returned in an index-only scan? */
+ bool *canreturn;
+ /* OID of the access method (in pg_am) */
+ Oid relam;
+ /* expressions for non-simple index columns */
+ List *indexprs;
+ /* predicate if a partial index, else NIL */
+ List *indpred;
+
+ /* targetlist representing index columns */
+ List *indextlist;
+
+ /*
+ * parent relation's baserestrictinfo list, less any conditions implied
by
+ * the index's predicate (unless it's a target rel, see comments in
+ * check_index_predicates())
+ */
+ List *indrestrictinfo;
+
+ /* true if index predicate matches query */
+ bool predOK;
+ /* true if a unique index */
+ bool unique;
+ /* is uniqueness enforced immediately? */
+ bool immediate;
+ /* true if index doesn't really exist */
+ bool hypothetical;
+
+ /*
+ * Remaining fields are copied from the index AM's API struct
+ * (IndexAmRoutine)
+ */
+ bool amcanorderbyop;
+ bool amoptionalkey;
+ bool amsearcharray;
+ bool amsearchnulls;
+ /* does AM have amgettuple interface? */
+ bool amhasgettuple;
+ /* does AM have amgetbitmap interface? */
+ bool amhasgetbitmap;
+ bool amcanparallel;
+ /* does AM have ammarkpos interface? */
+ bool amcanmarkpos;
/* Rather than include amapi.h here, we declare amcostestimate like
this */
void (*amcostestimate) (); /* AM's cost estimator */
};
@@ -902,19 +1016,35 @@ typedef struct ForeignKeyOptInfo
{
NodeTag type;
- /* Basic data about the foreign key (fetched from catalogs): */
- Index con_relid; /* RT index of the referencing
table */
- Index ref_relid; /* RT index of the referenced
table */
- int nkeys; /* number of columns in
the foreign key */
- AttrNumber conkey[INDEX_MAX_KEYS]; /* cols in referencing table */
- AttrNumber confkey[INDEX_MAX_KEYS]; /* cols in referenced
table */
- Oid conpfeqop[INDEX_MAX_KEYS]; /* PK = FK
operator OIDs */
-
- /* Derived info about whether FK's equality conditions match the query:
*/
- int nmatched_ec; /* # of FK cols matched by ECs
*/
- int nconst_ec; /* # of these ECs that
are ec_has_const */
- int nmatched_rcols; /* # of FK cols matched by
non-EC rinfos */
- int nmatched_ri; /* total # of non-EC rinfos
matched to FK */
+ /*
+ * Basic data about the foreign key (fetched from catalogs):
+ */
+
+ /* RT index of the referencing table */
+ Index con_relid;
+ /* RT index of the referenced table */
+ Index ref_relid;
+ /* number of columns in the foreign key */
+ int nkeys;
+ /* cols in referencing table */
+ AttrNumber conkey[INDEX_MAX_KEYS];
+ /* cols in referenced table */
+ AttrNumber confkey[INDEX_MAX_KEYS];
+ /* PK = FK operator OIDs */
+ Oid conpfeqop[INDEX_MAX_KEYS];
+
+ /*
+ * Derived info about whether FK's equality conditions match the query:
+ */
+
+ /* # of FK cols matched by ECs */
+ int nmatched_ec;
+ /* # of these ECs that are ec_has_const */
+ int nconst_ec;
+ /* # of FK cols matched by non-EC rinfos */
+ int nmatched_rcols;
+ /* total # of non-EC rinfos matched to FK */
+ int nmatched_ri;
/* Pointer to eclass matching each column's condition, if there is one
*/
struct EquivalenceClass *eclass[INDEX_MAX_KEYS];
/* Pointer to eclass member for the referencing Var, if there is one */
@@ -934,12 +1064,23 @@ typedef struct StatisticExtInfo
{
NodeTag type;
- Oid statOid; /* OID of the
statistics row */
- bool inherit; /* includes child relations */
- RelOptInfo *rel; /* back-link to statistic's
table */
- char kind; /* statistics kind of this
entry */
- Bitmapset *keys; /* attnums of the columns
covered */
- List *exprs; /* expressions */
+ /* OID of the statistics row */
+ Oid statOid;
+
+ /* includes child relations */
+ bool inherit;
+
+ /* back-link to statistic's table */
+ RelOptInfo *rel;
+
+ /* statistics kind of this entry */
+ char kind;
+
+ /* attnums of the columns covered */
+ Bitmapset *keys;
+
+ /* expressions */
+ List *exprs;
} StatisticExtInfo;
/*
@@ -1119,12 +1260,21 @@ typedef enum VolatileFunctionStatus
typedef struct PathTarget
{
NodeTag type;
- List *exprs; /* list of expressions to be
computed */
- Index *sortgrouprefs; /* corresponding sort/group refnos, or
0 */
- QualCost cost; /* cost of evaluating the
expressions */
- int width; /* estimated avg width
of result tuples */
- VolatileFunctionStatus has_volatile_expr; /* indicates if exprs
contain
-
* any volatile functions. */
+
+ /* list of expressions to be computed */
+ List *exprs;
+
+ /* corresponding sort/group refnos, or 0 */
+ Index *sortgrouprefs;
+
+ /* cost of evaluating the expressions */
+ QualCost cost;
+
+ /* estimated avg width of result tuples */
+ int width;
+
+ /* indicates if exprs contain any volatile functions */
+ VolatileFunctionStatus has_volatile_expr;
} PathTarget;
/* Convenience macro to get a sort/group refno from a PathTarget */
@@ -1189,24 +1339,32 @@ typedef struct Path
{
NodeTag type;
- NodeTag pathtype; /* tag identifying scan/join
method */
+ /* tag identifying scan/join method */
+ NodeTag pathtype;
- RelOptInfo *parent; /* the relation this path can
build */
- PathTarget *pathtarget; /* list of Vars/Exprs, cost, width */
+ /* the relation this path can build */
+ RelOptInfo *parent;
- ParamPathInfo *param_info; /* parameterization info, or NULL if
none */
+ /* list of Vars/Exprs, cost, width */
+ PathTarget *pathtarget;
- bool parallel_aware; /* engage parallel-aware logic? */
- bool parallel_safe; /* OK to use as part of parallel plan?
*/
- int parallel_workers; /* desired # of
workers; 0 = not parallel */
+ /* parameterization info, or NULL if none */
+ ParamPathInfo *param_info;
+
+ /* engage parallel-aware logic? */
+ bool parallel_aware;
+ /* OK to use as part of parallel plan? */
+ bool parallel_safe;
+ /* desired # of workers; 0 = not parallel */
+ int parallel_workers;
/* estimated size/costs for path (see costsize.c for more info) */
Cardinality rows; /* estimated number of result
tuples */
Cost startup_cost; /* cost expended before fetching any
tuples */
Cost total_cost; /* total cost (assuming all
tuples fetched) */
- List *pathkeys; /* sort ordering of path's output */
- /* pathkeys is a List of PathKey nodes; see above */
+ /* sort ordering of path's output; a List of PathKey nodes; see above */
+ List *pathkeys;
} Path;
/* Macro for extracting a path's parameterization relids; beware double eval */
@@ -2072,22 +2230,29 @@ typedef struct RestrictInfo
{
NodeTag type;
- Expr *clause; /* the represented clause of
WHERE or JOIN */
+ /* the represented clause of WHERE or JOIN */
+ Expr *clause;
- bool is_pushed_down; /* true if clause was pushed down in
level */
+ /* true if clause was pushed down in level */
+ bool is_pushed_down;
- bool outerjoin_delayed; /* true if delayed by lower
outer join */
+ /* true if delayed by lower outer join */
+ bool outerjoin_delayed;
- bool can_join; /* see comment above */
+ /* see comment above */
+ bool can_join;
- bool pseudoconstant; /* see comment above */
+ /* see comment above */
+ bool pseudoconstant;
- bool leakproof; /* true if known to contain no
leaked Vars */
+ /* true if known to contain no leaked Vars */
+ bool leakproof;
- VolatileFunctionStatus has_volatile; /* to indicate if clause
contains
-
* any volatile functions. */
+ /* to indicate if clause contains any volatile functions. */
+ VolatileFunctionStatus has_volatile;
- Index security_level; /* see comment above */
+ /* see comment above */
+ Index security_level;
/* The set of relids (varnos) actually referenced in the clause: */
Relids clause_relids;
@@ -2101,45 +2266,84 @@ typedef struct RestrictInfo
/* The relids used in the clause that are nullable by lower outer
joins: */
Relids nullable_relids;
- /* These fields are set for any binary opclause: */
- Relids left_relids; /* relids in left side of clause */
- Relids right_relids; /* relids in right side of clause */
+ /*
+ * Relids in the left/right side of the clause. These fields are set
for
+ * any binary opclause.
+ */
+ Relids left_relids;
+ Relids right_relids;
- /* This field is NULL unless clause is an OR clause: */
- Expr *orclause; /* modified clause with RestrictInfos */
+ /*
+ * Modified clause with RestrictInfos. This field is NULL unless clause
+ * is an OR clause.
+ */
+ Expr *orclause;
- /* This field is NULL unless clause is potentially redundant: */
- EquivalenceClass *parent_ec; /* generating EquivalenceClass */
+ /*
+ * Generating EquivalenceClass. This field is NULL unless clause is
+ * potentially redundant.
+ */
+ EquivalenceClass *parent_ec;
- /* cache space for cost and selectivity */
- QualCost eval_cost; /* eval cost of clause; -1 if
not yet set */
- Selectivity norm_selec; /* selectivity for "normal" (JOIN_INNER)
- * semantics;
-1 if not yet set; >1 means a
- * redundant
clause */
- Selectivity outer_selec; /* selectivity for outer join
semantics; -1 if
- * not yet set
*/
+ /*
+ * cache space for cost and selectivity
+ */
- /* valid if clause is mergejoinable, else NIL */
- List *mergeopfamilies; /* opfamilies containing clause
operator */
+ /* eval cost of clause; -1 if not yet set */
+ QualCost eval_cost;
- /* cache space for mergeclause processing; NULL if not yet set */
- EquivalenceClass *left_ec; /* EquivalenceClass containing lefthand
*/
- EquivalenceClass *right_ec; /* EquivalenceClass containing righthand */
- EquivalenceMember *left_em; /* EquivalenceMember for lefthand */
- EquivalenceMember *right_em; /* EquivalenceMember for righthand */
- List *scansel_cache; /* list of MergeScanSelCache structs */
+ /*
+ * selectivity for "normal" (JOIN_INNER) semantics; -1 if not yet set;
>1
+ * means a redundant clause
+ */
+ Selectivity norm_selec;
+ /* selectivity for outer join semantics; -1 if not yet set */
+ Selectivity outer_selec;
+
+ /*
+ * opfamilies containing clause operator; valid if clause is
+ * mergejoinable, else NIL
+ */
+ List *mergeopfamilies;
- /* transient workspace for use while considering a specific join path */
- bool outer_is_left; /* T = outer var on left, F = on right
*/
+ /*
+ * cache space for mergeclause processing; NULL if not yet set
+ */
- /* valid if clause is hashjoinable, else InvalidOid: */
- Oid hashjoinoperator; /* copy of clause
operator */
+ /* EquivalenceClass containing lefthand */
+ EquivalenceClass *left_ec;
+ /* EquivalenceClass containing righthand */
+ EquivalenceClass *right_ec;
+ /* EquivalenceMember for lefthand */
+ EquivalenceMember *left_em;
+ /* EquivalenceMember for righthand */
+ EquivalenceMember *right_em;
+ /* list of MergeScanSelCache structs */
+ List *scansel_cache;
- /* cache space for hashclause processing; -1 if not yet set */
- Selectivity left_bucketsize; /* avg bucketsize of left side */
- Selectivity right_bucketsize; /* avg bucketsize of right side */
- Selectivity left_mcvfreq; /* left side's most common val's freq */
- Selectivity right_mcvfreq; /* right side's most common val's freq
*/
+ /*
+ * transient workspace for use while considering a specific join path;
T =
+ * outer var on left, F = on right
+ */
+ bool outer_is_left;
+
+ /*
+ * copy of clause operator; valid if clause is hashjoinable, else
+ * InvalidOid
+ */
+ Oid hashjoinoperator;
+
+ /*
+ * cache space for hashclause processing; -1 if not yet set
+ */
+ /* avg bucketsize of left side */
+ Selectivity left_bucketsize;
+ /* avg bucketsize of right side */
+ Selectivity right_bucketsize;
+ /* left side's most common val's freq */
+ Selectivity left_mcvfreq;
+ /* right side's most common val's freq */
+ Selectivity right_mcvfreq;
/* hash equality operators used for memoize nodes, else InvalidOid */
Oid left_hasheqoperator;
@@ -2198,10 +2402,18 @@ typedef struct MergeScanSelCache
typedef struct PlaceHolderVar
{
Expr xpr;
- Expr *phexpr; /* the represented expression */
- Relids phrels; /* base relids syntactically
within expr src */
- Index phid; /* ID for PHV (unique within
planner run) */
- Index phlevelsup; /* > 0 if PHV belongs to outer
query */
+
+ /* the represented expression */
+ Expr *phexpr;
+
+ /* base relids syntactically within expr src */
+ Relids phrels;
+
+ /* ID for PHV (unique within planner run) */
+ Index phid;
+
+ /* > 0 if PHV belongs to outer query */
+ Index phlevelsup;
} PlaceHolderVar;
/*
@@ -2360,7 +2572,7 @@ typedef struct AppendRelInfo
* child column is dropped or doesn't exist in the parent.
*/
int num_child_cols; /* length of array */
- AttrNumber *parent_colnos; /* array of parent attnos, or zeroes */
+ AttrNumber *parent_colnos;
/*
* We store the parent table's OID here for inheritance, or InvalidOid
for
@@ -2428,12 +2640,23 @@ typedef struct PlaceHolderInfo
{
NodeTag type;
- Index phid; /* ID for PH (unique within
planner run) */
- PlaceHolderVar *ph_var; /* copy of PlaceHolderVar tree */
- Relids ph_eval_at; /* lowest level we can evaluate
value at */
- Relids ph_lateral; /* relids of contained lateral
refs, if any */
- Relids ph_needed; /* highest level the value is
needed at */
- int32 ph_width; /* estimated attribute width */
+ /* ID for PH (unique within planner run) */
+ Index phid;
+
+ /* copy of PlaceHolderVar tree */
+ PlaceHolderVar *ph_var;
+
+ /* lowest level we can evaluate value at */
+ Relids ph_eval_at;
+
+ /* relids of contained lateral refs, if any */
+ Relids ph_lateral;
+
+ /* highest level the value is needed at */
+ Relids ph_needed;
+
+ /* estimated attribute width */
+ int32 ph_width;
} PlaceHolderInfo;
/*
@@ -2445,13 +2668,26 @@ typedef struct MinMaxAggInfo
{
NodeTag type;
- Oid aggfnoid; /* pg_proc Oid of the
aggregate */
- Oid aggsortop; /* Oid of its sort
operator */
- Expr *target; /* expression we are
aggregating on */
- PlannerInfo *subroot; /* modified "root" for planning the
subquery */
- Path *path; /* access path for subquery */
- Cost pathcost; /* estimated cost to fetch
first row */
- Param *param; /* param for subplan's output */
+ /* pg_proc Oid of the aggregate */
+ Oid aggfnoid;
+
+ /* Oid of its sort operator */
+ Oid aggsortop;
+
+ /* expression we are aggregating on */
+ Expr *target;
+
+ /* modified "root" for planning the subquery */
+ PlannerInfo *subroot;
+
+ /* access path for subquery */
+ Path *path;
+
+ /* estimated cost to fetch first row */
+ Cost pathcost;
+
+ /* param for subplan's output */
+ Param *param;
} MinMaxAggInfo;
/*
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index 0ea9a22dfb..d5c0ebe859 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.h
@@ -274,14 +274,29 @@ typedef struct Append
typedef struct MergeAppend
{
Plan plan;
- Bitmapset *apprelids; /* RTIs of appendrel(s) formed by this
node */
+
+ /* RTIs of appendrel(s) formed by this node */
+ Bitmapset *apprelids;
+
List *mergeplans;
+
/* these fields are just like the sort-key info in struct Sort: */
- int numCols; /* number of sort-key
columns */
- AttrNumber *sortColIdx; /* their indexes in the target list */
- Oid *sortOperators; /* OIDs of operators to sort
them by */
- Oid *collations; /* OIDs of collations */
- bool *nullsFirst; /* NULLS FIRST/LAST directions */
+
+ /* number of sort-key columns */
+ int numCols;
+
+ /* their indexes in the target list */
+ AttrNumber *sortColIdx;
+
+ /* OIDs of operators to sort them by */
+ Oid *sortOperators;
+
+ /* OIDs of collations */
+ Oid *collations;
+
+ /* NULLS FIRST/LAST directions */
+ bool *nullsFirst;
+
/* Info for run-time subplan pruning; NULL if we're not doing that */
struct PartitionPruneInfo *part_prune_info;
} MergeAppend;
@@ -297,14 +312,24 @@ typedef struct MergeAppend
typedef struct RecursiveUnion
{
Plan plan;
- int wtParam; /* ID of Param
representing work table */
+
+ /* ID of Param representing work table */
+ int wtParam;
+
/* Remaining fields are zero/null in UNION ALL case */
- int numCols; /* number of columns to
check for
- *
duplicate-ness */
- AttrNumber *dupColIdx; /* their indexes in the target list */
- Oid *dupOperators; /* equality operators to
compare with */
+
+ /* number of columns to check for duplicate-ness */
+ int numCols;
+
+ /* their indexes in the target list */
+ AttrNumber *dupColIdx;
+
+ /* equality operators to compare with */
+ Oid *dupOperators;
Oid *dupCollations;
- long numGroups; /* estimated number of groups
in input */
+
+ /* estimated number of groups in input */
+ long numGroups;
} RecursiveUnion;
/* ----------------
@@ -777,13 +802,26 @@ typedef struct NestLoopParam
typedef struct MergeJoin
{
Join join;
- bool skip_mark_restore; /* Can we skip mark/restore
calls? */
- List *mergeclauses; /* mergeclauses as expression trees */
+
+ /* Can we skip mark/restore calls? */
+ bool skip_mark_restore;
+
+ /* mergeclauses as expression trees */
+ List *mergeclauses;
+
/* these are arrays, but have the same length as the mergeclauses list:
*/
- Oid *mergeFamilies; /* per-clause OIDs of btree
opfamilies */
- Oid *mergeCollations; /* per-clause OIDs of
collations */
- int *mergeStrategies; /* per-clause ordering (ASC or
DESC) */
- bool *mergeNullsFirst; /* per-clause nulls ordering */
+
+ /* per-clause OIDs of btree opfamilies */
+ Oid *mergeFamilies;
+
+ /* per-clause OIDs of collations */
+ Oid *mergeCollations;
+
+ /* per-clause ordering (ASC or DESC) */
+ int *mergeStrategies;
+
+ /* per-clause nulls ordering */
+ bool *mergeNullsFirst;
} MergeJoin;
/* ----------------
@@ -821,21 +859,38 @@ typedef struct Memoize
{
Plan plan;
- int numKeys; /* size of the two
arrays below */
-
- Oid *hashOperators; /* hash operators for each key
*/
- Oid *collations; /* collations for each key */
- List *param_exprs; /* cache keys in the form of exprs
containing
- * parameters */
- bool singlerow; /* true if the cache entry
should be marked as
- * complete
after we store the first tuple in
- * it. */
- bool binary_mode; /* true when cache key should be
compared bit
- * by bit,
false when using hash equality ops */
- uint32 est_entries; /* The maximum number of entries that
the
- * planner
expects will fit in the cache, or 0
- * if unknown */
- Bitmapset *keyparamids; /* paramids from param_exprs */
+ /* size of the two arrays below */
+ int numKeys;
+
+ /* hash operators for each key */
+ Oid *hashOperators;
+
+ /* collations for each key */
+ Oid *collations;
+
+ /* cache keys in the form of exprs containing parameters */
+ List *param_exprs;
+
+ /*
+ * true if the cache entry should be marked as complete after we store
the
+ * first tuple in it.
+ */
+ bool singlerow;
+
+ /*
+ * true when cache key should be compared bit by bit, false when using
+ * hash equality ops
+ */
+ bool binary_mode;
+
+ /*
+ * The maximum number of entries that the planner expects will fit in
the
+ * cache, or 0 if unknown
+ */
+ uint32 est_entries;
+
+ /* paramids from param_exprs */
+ Bitmapset *keyparamids;
} Memoize;
/* ----------------
@@ -845,11 +900,21 @@ typedef struct Memoize
typedef struct Sort
{
Plan plan;
- int numCols; /* number of sort-key
columns */
- AttrNumber *sortColIdx; /* their indexes in the target list */
- Oid *sortOperators; /* OIDs of operators to sort
them by */
- Oid *collations; /* OIDs of collations */
- bool *nullsFirst; /* NULLS FIRST/LAST directions */
+
+ /* number of sort-key columns */
+ int numCols;
+
+ /* their indexes in the target list */
+ AttrNumber *sortColIdx;
+
+ /* OIDs of operators to sort them by */
+ Oid *sortOperators;
+
+ /* OIDs of collations */
+ Oid *collations;
+
+ /* NULLS FIRST/LAST directions */
+ bool *nullsFirst;
} Sort;
/* ----------------
@@ -871,9 +936,15 @@ typedef struct IncrementalSort
typedef struct Group
{
Plan plan;
- int numCols; /* number of grouping
columns */
- AttrNumber *grpColIdx; /* their indexes in the target list */
- Oid *grpOperators; /* equality operators to
compare with */
+
+ /* number of grouping columns */
+ int numCols;
+
+ /* their indexes in the target list */
+ AttrNumber *grpColIdx;
+
+ /* equality operators to compare with */
+ Oid *grpOperators;
Oid *grpCollations;
} Group;
@@ -894,18 +965,39 @@ typedef struct Group
typedef struct Agg
{
Plan plan;
- AggStrategy aggstrategy; /* basic strategy, see nodes.h */
- AggSplit aggsplit; /* agg-splitting mode, see
nodes.h */
- int numCols; /* number of grouping
columns */
- AttrNumber *grpColIdx; /* their indexes in the target list */
- Oid *grpOperators; /* equality operators to
compare with */
+
+ /* basic strategy, see nodes.h */
+ AggStrategy aggstrategy;
+
+ /* agg-splitting mode, see nodes.h */
+ AggSplit aggsplit;
+
+ /* number of grouping columns */
+ int numCols;
+
+ /* their indexes in the target list */
+ AttrNumber *grpColIdx;
+
+ /* equality operators to compare with */
+ Oid *grpOperators;
Oid *grpCollations;
- long numGroups; /* estimated number of groups
in input */
- uint64 transitionSpace; /* for pass-by-ref transition
data */
- Bitmapset *aggParams; /* IDs of Params used in Aggref inputs
*/
+
+ /* estimated number of groups in input */
+ long numGroups;
+
+ /* for pass-by-ref transition data */
+ uint64 transitionSpace;
+
+ /* IDs of Params used in Aggref inputs */
+ Bitmapset *aggParams;
+
/* Note: planner provides numGroups & aggParams only in HASHED/MIXED
case */
- List *groupingSets; /* grouping sets to use */
- List *chain; /* chained Agg/Sort nodes */
+
+ /* grouping sets to use */
+ List *groupingSets;
+
+ /* chained Agg/Sort nodes */
+ List *chain;
} Agg;
/* ----------------
@@ -915,28 +1007,71 @@ typedef struct Agg
typedef struct WindowAgg
{
Plan plan;
- Index winref; /* ID referenced by window
functions */
- int partNumCols; /* number of columns in
partition clause */
- AttrNumber *partColIdx; /* their indexes in the target list */
- Oid *partOperators; /* equality operators for
partition columns */
- Oid *partCollations; /* collations for partition columns
*/
- int ordNumCols; /* number of columns in
ordering clause */
- AttrNumber *ordColIdx; /* their indexes in the target list */
- Oid *ordOperators; /* equality operators for
ordering columns */
- Oid *ordCollations; /* collations for ordering
columns */
- int frameOptions; /* frame_clause options, see
WindowDef */
- Node *startOffset; /* expression for starting bound, if
any */
- Node *endOffset; /* expression for ending bound, if any
*/
- List *runCondition; /* qual to help short-circuit execution
*/
- List *runConditionOrig; /* runCondition for display in EXPLAIN
*/
+
+ /* ID referenced by window functions */
+ Index winref;
+
+ /* number of columns in partition clause */
+ int partNumCols;
+
+ /* their indexes in the target list */
+ AttrNumber *partColIdx;
+
+ /* equality operators for partition columns */
+ Oid *partOperators;
+
+ /* collations for partition columns */
+ Oid *partCollations;
+
+ /* number of columns in ordering clause */
+ int ordNumCols;
+
+ /* their indexes in the target list */
+ AttrNumber *ordColIdx;
+
+ /* equality operators for ordering columns */
+ Oid *ordOperators;
+
+ /* collations for ordering columns */
+ Oid *ordCollations;
+
+ /* frame_clause options, see WindowDef */
+ int frameOptions;
+
+ /* expression for starting bound, if any */
+ Node *startOffset;
+
+ /* expression for ending bound, if any */
+ Node *endOffset;
+
+ /* qual to help short-circuit execution */
+ List *runCondition;
+
+ /* runCondition for display in EXPLAIN */
+ List *runConditionOrig;
+
/* these fields are used with RANGE offset PRECEDING/FOLLOWING: */
- Oid startInRangeFunc; /* in_range function
for startOffset */
- Oid endInRangeFunc; /* in_range function for
endOffset */
- Oid inRangeColl; /* collation for in_range tests
*/
- bool inRangeAsc; /* use ASC sort order for
in_range tests? */
- bool inRangeNullsFirst; /* nulls sort first for
in_range tests? */
- bool topWindow; /* false for all apart from the
WindowAgg
- * that's
closest to the root of the plan */
+
+ /* in_range function for startOffset */
+ Oid startInRangeFunc;
+
+ /* in_range function for endOffset */
+ Oid endInRangeFunc;
+
+ /* collation for in_range tests */
+ Oid inRangeColl;
+
+ /* use ASC sort order for in_range tests? */
+ bool inRangeAsc;
+
+ /* nulls sort first for in_range tests? */
+ bool inRangeNullsFirst;
+
+ /*
+ * false for all apart from the WindowAgg that's closest to the root of
+ * the plan
+ */
+ bool topWindow;
} WindowAgg;
/* ----------------
@@ -946,10 +1081,18 @@ typedef struct WindowAgg
typedef struct Unique
{
Plan plan;
- int numCols; /* number of columns to
check for uniqueness */
- AttrNumber *uniqColIdx; /* their indexes in the target list */
- Oid *uniqOperators; /* equality operators to
compare with */
- Oid *uniqCollations; /* collations for equality
comparisons */
+
+ /* number of columns to check for uniqueness */
+ int numCols;
+
+ /* their indexes in the target list */
+ AttrNumber *uniqColIdx;
+
+ /* equality operators to compare with */
+ Oid *uniqOperators;
+
+ /* collations for equality comparisons */
+ Oid *uniqCollations;
} Unique;
/* ------------
@@ -981,16 +1124,35 @@ typedef struct Gather
typedef struct GatherMerge
{
Plan plan;
- int num_workers; /* planned number of worker
processes */
- int rescan_param; /* ID of Param that signals a
rescan, or -1 */
+
+ /* planned number of worker processes */
+ int num_workers;
+
+ /* ID of Param that signals a rescan, or -1 */
+ int rescan_param;
+
/* remaining fields are just like the sort-key info in struct Sort */
- int numCols; /* number of sort-key
columns */
- AttrNumber *sortColIdx; /* their indexes in the target list */
- Oid *sortOperators; /* OIDs of operators to sort
them by */
- Oid *collations; /* OIDs of collations */
- bool *nullsFirst; /* NULLS FIRST/LAST directions */
- Bitmapset *initParam; /* param id's of initplans which are
referred
- * at gather
merge or one of it's child node */
+
+ /* number of sort-key columns */
+ int numCols;
+
+ /* their indexes in the target list */
+ AttrNumber *sortColIdx;
+
+ /* OIDs of operators to sort them by */
+ Oid *sortOperators;
+
+ /* OIDs of collations */
+ Oid *collations;
+
+ /* NULLS FIRST/LAST directions */
+ bool *nullsFirst;
+
+ /*
+ * param id's of initplans which are referred at gather merge or one of
+ * it's child node
+ */
+ Bitmapset *initParam;
} GatherMerge;
/* ----------------
@@ -1024,16 +1186,31 @@ typedef struct Hash
typedef struct SetOp
{
Plan plan;
- SetOpCmd cmd; /* what to do, see nodes.h */
- SetOpStrategy strategy; /* how to do it, see nodes.h */
- int numCols; /* number of columns to
check for
- *
duplicate-ness */
- AttrNumber *dupColIdx; /* their indexes in the target list */
- Oid *dupOperators; /* equality operators to
compare with */
+
+ /* what to do, see nodes.h */
+ SetOpCmd cmd;
+
+ /* how to do it, see nodes.h */
+ SetOpStrategy strategy;
+
+ /* number of columns to check for duplicate-ness */
+ int numCols;
+
+ /* their indexes in the target list */
+ AttrNumber *dupColIdx;
+
+ /* equality operators to compare with */
+ Oid *dupOperators;
Oid *dupCollations;
- AttrNumber flagColIdx; /* where is the flag column, if
any */
- int firstFlag; /* flag value for first
input relation */
- long numGroups; /* estimated number of groups
in input */
+
+ /* where is the flag column, if any */
+ AttrNumber flagColIdx;
+
+ /* flag value for first input relation */
+ int firstFlag;
+
+ /* estimated number of groups in input */
+ long numGroups;
} SetOp;
/* ----------------
@@ -1062,13 +1239,27 @@ typedef struct LockRows
typedef struct Limit
{
Plan plan;
- Node *limitOffset; /* OFFSET parameter, or NULL if none */
- Node *limitCount; /* COUNT parameter, or NULL if none */
- LimitOption limitOption; /* limit type */
- int uniqNumCols; /* number of columns to check
for similarity */
- AttrNumber *uniqColIdx; /* their indexes in the target list */
- Oid *uniqOperators; /* equality operators to
compare with */
- Oid *uniqCollations; /* collations for equality
comparisons */
+
+ /* OFFSET parameter, or NULL if none */
+ Node *limitOffset;
+
+ /* COUNT parameter, or NULL if none */
+ Node *limitCount;
+
+ /* limit type */
+ LimitOption limitOption;
+
+ /* number of columns to check for similarity */
+ int uniqNumCols;
+
+ /* their indexes in the target list */
+ AttrNumber *uniqColIdx;
+
+ /* equality operators to compare with */
+ Oid *uniqOperators;
+
+ /* collations for equality comparisons */
+ Oid *uniqCollations;
} Limit;
@@ -1223,13 +1414,24 @@ typedef struct PartitionPruneInfo
typedef struct PartitionedRelPruneInfo
{
NodeTag type;
- Index rtindex; /* RT index of partition rel
for this level */
- Bitmapset *present_parts; /* Indexes of all partitions which
subplans or
- * subparts are
present for */
- int nparts; /* Length of the
following arrays: */
- int *subplan_map; /* subplan index by partition
index, or -1 */
- int *subpart_map; /* subpart index by partition
index, or -1 */
- Oid *relid_map; /* relation OID by partition
index, or 0 */
+
+ /* RT index of partition rel for this level */
+ Index rtindex;
+
+ /* Indexes of all partitions which subplans or subparts are present for
*/
+ Bitmapset *present_parts;
+
+ /* Length of the following arrays: */
+ int nparts;
+
+ /* subplan index by partition index, or -1 */
+ int *subplan_map;
+
+ /* subpart index by partition index, or -1 */
+ int *subpart_map;
+
+ /* relation OID by partition index, or 0 */
+ Oid *relid_map;
/*
* initial_pruning_steps shows how to prune during executor startup
(i.e.,
@@ -1239,8 +1441,9 @@ typedef struct PartitionedRelPruneInfo
*/
List *initial_pruning_steps; /* List of PartitionPruneStep */
List *exec_pruning_steps; /* List of PartitionPruneStep */
- Bitmapset *execparamids; /* All PARAM_EXEC Param IDs in
- *
exec_pruning_steps */
+
+ /* All PARAM_EXEC Param IDs in exec_pruning_steps */
+ Bitmapset *execparamids;
} PartitionedRelPruneInfo;
/*
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index 51505eee85..54f942e0fd 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -329,26 +329,66 @@ typedef struct Param
typedef struct Aggref
{
Expr xpr;
- Oid aggfnoid; /* pg_proc Oid of the
aggregate */
- Oid aggtype; /* type Oid of result
of the aggregate */
- Oid aggcollid; /* OID of collation of
result */
- Oid inputcollid; /* OID of collation that
function should use */
- Oid aggtranstype; /* type Oid of aggregate's
transition value */
- List *aggargtypes; /* type Oids of direct and aggregated
args */
- List *aggdirectargs; /* direct arguments, if an ordered-set
agg */
- List *args; /* aggregated arguments and
sort expressions */
- List *aggorder; /* ORDER BY (list of SortGroupClause) */
- List *aggdistinct; /* DISTINCT (list of SortGroupClause) */
- Expr *aggfilter; /* FILTER expression, if any */
- bool aggstar; /* true if argument list was
really '*' */
- bool aggvariadic; /* true if variadic arguments have been
- * combined
into an array last argument */
- char aggkind; /* aggregate kind (see
pg_aggregate.h) */
- Index agglevelsup; /* > 0 if agg belongs to outer query */
- AggSplit aggsplit; /* expected agg-splitting mode
of parent Agg */
- int aggno; /* unique ID within the
Agg node */
- int aggtransno; /* unique ID of
transition state in the Agg */
- int location; /* token location, or
-1 if unknown */
+
+ /* pg_proc Oid of the aggregate */
+ Oid aggfnoid;
+
+ /* type Oid of result of the aggregate */
+ Oid aggtype;
+
+ /* OID of collation of result */
+ Oid aggcollid;
+
+ /* OID of collation that function should use */
+ Oid inputcollid;
+
+ /* type Oid of aggregate's transition value */
+ Oid aggtranstype;
+
+ /* type Oids of direct and aggregated args */
+ List *aggargtypes;
+
+ /* direct arguments, if an ordered-set agg */
+ List *aggdirectargs;
+
+ /* aggregated arguments and sort expressions */
+ List *args;
+
+ /* ORDER BY (list of SortGroupClause) */
+ List *aggorder;
+
+ /* DISTINCT (list of SortGroupClause) */
+ List *aggdistinct;
+
+ /* FILTER expression, if any */
+ Expr *aggfilter;
+
+ /* true if argument list was really '*' */
+ bool aggstar;
+
+ /*
+ * true if variadic arguments have been combined into an array last
+ * argument
+ */
+ bool aggvariadic;
+
+ /* aggregate kind (see pg_aggregate.h) */
+ char aggkind;
+
+ /* > 0 if agg belongs to outer query */
+ Index agglevelsup;
+
+ /* expected agg-splitting mode of parent Agg */
+ AggSplit aggsplit;
+
+ /* unique ID within the Agg node */
+ int aggno;
+
+ /* unique ID of transition state in the Agg */
+ int aggtransno;
+
+ /* token location, or -1 if unknown */
+ int location;
} Aggref;
/*
@@ -378,12 +418,21 @@ typedef struct Aggref
typedef struct GroupingFunc
{
Expr xpr;
- List *args; /* arguments, not evaluated but
kept for
- * benefit of
EXPLAIN etc. */
- List *refs; /* ressortgrouprefs of
arguments */
- List *cols; /* actual column positions set
by planner */
- Index agglevelsup; /* same as Aggref.agglevelsup */
- int location; /* token location */
+
+ /* arguments, not evaluated but kept for benefit of EXPLAIN etc. */
+ List *args;
+
+ /* ressortgrouprefs of arguments */
+ List *refs;
+
+ /* actual column positions set by planner */
+ List *cols;
+
+ /* same as Aggref.agglevelsup */
+ Index agglevelsup;
+
+ /* token location */
+ int location;
} GroupingFunc;
/*
@@ -548,14 +597,30 @@ typedef struct NamedArgExpr
typedef struct OpExpr
{
Expr xpr;
- Oid opno; /* PG_OPERATOR OID of
the operator */
- Oid opfuncid; /* PG_PROC OID of
underlying function */
- Oid opresulttype; /* PG_TYPE OID of result value
*/
- bool opretset; /* true if operator returns set
*/
- Oid opcollid; /* OID of collation of
result */
- Oid inputcollid; /* OID of collation that
operator should use */
- List *args; /* arguments to the operator (1
or 2) */
- int location; /* token location, or
-1 if unknown */
+
+ /* PG_OPERATOR OID of the operator */
+ Oid opno;
+
+ /* PG_PROC OID of underlying function */
+ Oid opfuncid;
+
+ /* PG_TYPE OID of result value */
+ Oid opresulttype;
+
+ /* true if operator returns set */
+ bool opretset;
+
+ /* OID of collation of result */
+ Oid opcollid;
+
+ /* OID of collation that operator should use */
+ Oid inputcollid;
+
+ /* arguments to the operator (1 or 2) */
+ List *args;
+
+ /* token location, or -1 if unknown */
+ int location;
} OpExpr;
/*
@@ -605,15 +670,30 @@ typedef OpExpr NullIfExpr;
typedef struct ScalarArrayOpExpr
{
Expr xpr;
- Oid opno; /* PG_OPERATOR OID of
the operator */
- Oid opfuncid; /* PG_PROC OID of
comparison function */
- Oid hashfuncid; /* PG_PROC OID of hash
func or InvalidOid */
- Oid negfuncid; /* PG_PROC OID of
negator of opfuncid function
- * or
InvalidOid. See above */
- bool useOr; /* true for ANY, false for ALL
*/
- Oid inputcollid; /* OID of collation that
operator should use */
- List *args; /* the scalar and array
operands */
- int location; /* token location, or
-1 if unknown */
+
+ /* PG_OPERATOR OID of the operator */
+ Oid opno;
+
+ /* PG_PROC OID of comparison function */
+ Oid opfuncid;
+
+ /* PG_PROC OID of hash func or InvalidOid */
+ Oid hashfuncid;
+
+ /* PG_PROC OID of negator of opfuncid function or InvalidOid. See
above */
+ Oid negfuncid;
+
+ /* true for ANY, false for ALL */
+ bool useOr;
+
+ /* OID of collation that operator should use */
+ Oid inputcollid;
+
+ /* the scalar and array operands */
+ List *args;
+
+ /* token location, or -1 if unknown */
+ int location;
} ScalarArrayOpExpr;
/*
--
2.36.1