Reformat some node comments

Reformat some comments in node field definitions to avoid long lines.

This makes room for per-field annotations in a future patch to
generate node support functions automatically.

Discussion: https://www.postgresql.org/message-id/c5906b07-220a-a3d4-8ff3-8ee593009424@enterprisedb.com
This commit is contained in:
Peter Eisentraut 2022-07-02 12:33:07 +02:00
parent 94ebf8117c
commit 835d476fd2
4 changed files with 939 additions and 387 deletions

View File

@ -123,7 +123,8 @@ typedef struct Query
QuerySource querySource; /* where did I come from? */ 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? */ bool canSetTag; /* do I set the command result tag? */

View File

@ -226,8 +226,8 @@ struct PlannerInfo
* even when using the hash table for lookups; this simplifies life for * even when using the hash table for lookups; this simplifies life for
* GEQO. * GEQO.
*/ */
List *join_rel_list; /* list of join-relation RelOptInfos */ List *join_rel_list;
struct HTAB *join_rel_hash; /* optional hashtable for join relations */ struct HTAB *join_rel_hash;
/* /*
* When doing a dynamic-programming-style join search, join_rel_level[k] * When doing a dynamic-programming-style join search, join_rel_level[k]
@ -329,11 +329,16 @@ struct PlannerInfo
*/ */
List *update_colnos; List *update_colnos;
/* Fields filled during create_plan() for use in setrefs.c */ /*
AttrNumber *grouping_map; /* for GroupingFunc fixup */ * Fields filled during create_plan() for use in setrefs.c
List *minmax_aggs; /* List of MinMaxAggInfos */ */
/* 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 Cardinality total_table_pages; /* # of pages in all non-dummy tables of
* query */ * query */
@ -369,9 +374,12 @@ struct PlannerInfo
Relids curOuterRels; /* outer rels above current node */ Relids curOuterRels; /* outer rels above current node */
List *curOuterParams; /* not-yet-assigned NestLoopParams */ List *curOuterParams; /* not-yet-assigned NestLoopParams */
/* These fields are workspace for setrefs.c */ /*
bool *isAltSubplan; /* array corresponding to glob->subplans */ * These fields are workspace for setrefs.c. Each is an array
bool *isUsedSubplan; /* array corresponding to glob->subplans */ * corresponding to glob->subplans.
*/
bool *isAltSubplan;
bool *isUsedSubplan;
/* optional private data for join_search_hook, e.g., GEQO */ /* optional private data for join_search_hook, e.g., GEQO */
void *join_search_private; void *join_search_private;
@ -678,21 +686,37 @@ typedef struct RelOptInfo
RelOptKind reloptkind; 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? */ * per-relation planner control flags
bool consider_param_startup; /* ditto, for parameterized paths? */ */
bool consider_parallel; /* consider parallel paths? */ /* 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 *pathlist; /* Path structures */
List *ppilist; /* ParamPathInfos used in pathlist */ List *ppilist; /* ParamPathInfos used in pathlist */
List *partial_pathlist; /* partial Paths */ List *partial_pathlist; /* partial Paths */
@ -701,79 +725,132 @@ typedef struct RelOptInfo
struct Path *cheapest_unique_path; struct Path *cheapest_unique_path;
List *cheapest_parameterized_paths; List *cheapest_parameterized_paths;
/* parameterization information needed for both base rels and join rels */ /*
/* (see also lateral_vars and lateral_referencers) */ * parameterization information needed for both base rels and join rels
Relids direct_lateral_relids; /* rels directly laterally referenced */ * (see also lateral_vars and lateral_referencers)
Relids lateral_relids; /* minimum parameterization of rel */ */
/* 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; Index relid;
Oid reltablespace; /* containing tablespace */ /* containing tablespace */
RTEKind rtekind; /* RELATION, SUBQUERY, FUNCTION, etc */ Oid reltablespace;
AttrNumber min_attr; /* smallest attrno of rel (often <0) */ /* RELATION, SUBQUERY, FUNCTION, etc */
AttrNumber max_attr; /* largest attrno of rel */ RTEKind rtekind;
Relids *attr_needed; /* array indexed [min_attr .. max_attr] */ /* smallest attrno of rel (often <0) */
int32 *attr_widths; /* array indexed [min_attr .. max_attr] */ AttrNumber min_attr;
List *lateral_vars; /* LATERAL Vars and PHVs referenced by rel */ /* largest attrno of rel */
Relids lateral_referencers; /* rels that reference me laterally */ AttrNumber max_attr;
List *indexlist; /* list of IndexOptInfo */ /* array indexed [min_attr .. max_attr] */
List *statlist; /* list of StatisticExtInfo */ Relids *attr_needed;
BlockNumber pages; /* size estimates derived from pg_class */ /* 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; Cardinality tuples;
double allvisfrac; 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 */ PlannerInfo *subroot; /* if subquery */
List *subplan_params; /* if subquery */ List *subplan_params; /* if subquery */
int rel_parallel_workers; /* wanted number of parallel workers */ /* wanted number of parallel workers */
uint32 amflags; /* Bitmask of optional features supported by int rel_parallel_workers;
* the table AM */ /* Bitmask of optional features supported by the table AM */
uint32 amflags;
/* Information about foreign tables and foreign joins */ /*
Oid serverid; /* identifies server for the table or join */ * Information about foreign tables and foreign joins
Oid userid; /* identifies user to check access as */ */
bool useridiscurrent; /* join is only valid for current user */ /* 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 */ /* use "struct FdwRoutine" to avoid including fdwapi.h here */
struct FdwRoutine *fdwroutine; struct FdwRoutine *fdwroutine;
void *fdw_private; void *fdw_private;
/* cache space for remembering if we have proven this relation unique */ /*
List *unique_for_rels; /* known unique for these other relid * cache space for remembering if we have proven this relation unique
* set(s) */ */
List *non_unique_for_rels; /* known not unique for these set(s) */ /* 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: */ /*
List *baserestrictinfo; /* RestrictInfo structures (if base rel) */ * used by various scans and joins:
QualCost baserestrictcost; /* cost of evaluating the above */ */
Index baserestrict_min_security; /* min security_level found in /* RestrictInfo structures (if base rel) */
* baserestrictinfo */ List *baserestrictinfo;
List *joininfo; /* RestrictInfo structures for join clauses /* cost of evaluating the above */
* involving this rel */ QualCost baserestrictcost;
bool has_eclass_joins; /* T means joininfo is incomplete */ /* 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: */ /*
bool consider_partitionwise_join; /* consider partitionwise join * used by partitionwise joins:
* paths? (if partitioned rel) */ */
Relids top_parent_relids; /* Relids of topmost parents (if "other" /* consider partitionwise join paths? (if partitioned rel) */
* rel) */ bool consider_partitionwise_join;
/* Relids of topmost parents (if "other" rel) */
Relids top_parent_relids;
/* used for partitioned relations: */ /*
PartitionScheme part_scheme; /* Partitioning scheme */ * used for partitioned relations:
int nparts; /* Number of partitions; -1 if not yet set; in */
* case of a join relation 0 means it's /* Partitioning scheme */
* considered unpartitioned */ PartitionScheme part_scheme;
struct PartitionBoundInfoData *boundinfo; /* Partition bounds */
bool partbounds_merged; /* True if partition bounds were created /*
* by partition_bounds_merge() */ * Number of partitions; -1 if not yet set; in case of a join relation 0
List *partition_qual; /* Partition constraint, if not the root */ * means it's considered unpartitioned
struct RelOptInfo **part_rels; /* Array of RelOptInfos of partitions, */
* stored in the same order as bounds */ int nparts;
Bitmapset *live_parts; /* Bitmap with members acting as indexes into /* Partition bounds */
* the part_rels[] array to indicate which struct PartitionBoundInfoData *boundinfo;
* partitions survived partition pruning. */ /* True if partition bounds were created by partition_bounds_merge() */
Relids all_partrels; /* Relids set of all partition relids */ bool partbounds_merged;
List **partexprs; /* Non-nullable partition key expressions */ /* Partition constraint, if not the root */
List **nullable_partexprs; /* Nullable partition key expressions */ 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; } RelOptInfo;
/* /*
@ -836,56 +913,93 @@ struct IndexOptInfo
{ {
NodeTag type; NodeTag type;
Oid indexoid; /* OID of the index relation */ /* OID of the index relation */
Oid reltablespace; /* tablespace of index (not table) */ Oid indexoid;
RelOptInfo *rel; /* back-link to index's table */ /* tablespace of index (not table) */
Oid reltablespace;
/* back-link to index's table */
RelOptInfo *rel;
/* index-size statistics (from pg_class and elsewhere) */ /*
BlockNumber pages; /* number of disk pages in index */ * index-size statistics (from pg_class and elsewhere)
Cardinality tuples; /* number of index tuples in index */ */
int tree_height; /* index tree height, or -1 if unknown */ /* 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 */ /*
int ncolumns; /* number of columns in index */ * index descriptor information
int nkeycolumns; /* number of key columns in index */ */
int *indexkeys; /* column numbers of index's attributes both /* number of columns in index */
* key and included columns, or 0 */ int ncolumns;
Oid *indexcollations; /* OIDs of collations of index columns */ /* number of key columns in index */
Oid *opfamily; /* OIDs of operator families for columns */ int nkeycolumns;
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 */ * 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;
List *indextlist; /* targetlist representing index columns */ /* targetlist representing index columns */
List *indextlist;
List *indrestrictinfo; /* parent relation's baserestrictinfo /*
* list, less any conditions implied by * parent relation's baserestrictinfo list, less any conditions implied by
* the index's predicate (unless it's a * the index's predicate (unless it's a target rel, see comments in
* target rel, see comments in * check_index_predicates())
* check_index_predicates()) */ */
List *indrestrictinfo;
bool predOK; /* true if index predicate matches query */ /* true if index predicate matches query */
bool unique; /* true if a unique index */ bool predOK;
bool immediate; /* is uniqueness enforced immediately? */ /* true if a unique index */
bool hypothetical; /* true if index doesn't really exist */ 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: */ /*
bool amcanorderbyop; /* does AM support order by operator result? */ * Remaining fields are copied from the index AM's API struct
bool amoptionalkey; /* can query omit key for the first column? */ * (IndexAmRoutine)
bool amsearcharray; /* can AM handle ScalarArrayOpExpr quals? */ */
bool amsearchnulls; /* can AM search for NULL/NOT NULL entries? */ bool amcanorderbyop;
bool amhasgettuple; /* does AM have amgettuple interface? */ bool amoptionalkey;
bool amhasgetbitmap; /* does AM have amgetbitmap interface? */ bool amsearcharray;
bool amcanparallel; /* does AM support parallel scan? */ bool amsearchnulls;
bool amcanmarkpos; /* does AM support mark/restore? */ /* 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 */ /* Rather than include amapi.h here, we declare amcostestimate like this */
void (*amcostestimate) (); /* AM's cost estimator */ void (*amcostestimate) (); /* AM's cost estimator */
}; };
@ -902,19 +1016,35 @@ typedef struct ForeignKeyOptInfo
{ {
NodeTag type; NodeTag type;
/* Basic data about the foreign key (fetched from catalogs): */ /*
Index con_relid; /* RT index of the referencing table */ * Basic data about the foreign key (fetched from catalogs):
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: */ /* RT index of the referencing table */
int nmatched_ec; /* # of FK cols matched by ECs */ Index con_relid;
int nconst_ec; /* # of these ECs that are ec_has_const */ /* RT index of the referenced table */
int nmatched_rcols; /* # of FK cols matched by non-EC rinfos */ Index ref_relid;
int nmatched_ri; /* total # of non-EC rinfos matched to FK */ /* 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 */ /* Pointer to eclass matching each column's condition, if there is one */
struct EquivalenceClass *eclass[INDEX_MAX_KEYS]; struct EquivalenceClass *eclass[INDEX_MAX_KEYS];
/* Pointer to eclass member for the referencing Var, if there is one */ /* Pointer to eclass member for the referencing Var, if there is one */
@ -934,12 +1064,23 @@ typedef struct StatisticExtInfo
{ {
NodeTag type; NodeTag type;
Oid statOid; /* OID of the statistics row */ /* OID of the statistics row */
bool inherit; /* includes child relations */ Oid statOid;
RelOptInfo *rel; /* back-link to statistic's table */
char kind; /* statistics kind of this entry */ /* includes child relations */
Bitmapset *keys; /* attnums of the columns covered */ bool inherit;
List *exprs; /* expressions */
/* 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; } StatisticExtInfo;
/* /*
@ -1119,12 +1260,21 @@ typedef enum VolatileFunctionStatus
typedef struct PathTarget typedef struct PathTarget
{ {
NodeTag type; NodeTag type;
List *exprs; /* list of expressions to be computed */
Index *sortgrouprefs; /* corresponding sort/group refnos, or 0 */ /* list of expressions to be computed */
QualCost cost; /* cost of evaluating the expressions */ List *exprs;
int width; /* estimated avg width of result tuples */
VolatileFunctionStatus has_volatile_expr; /* indicates if exprs contain /* corresponding sort/group refnos, or 0 */
* any volatile functions. */ 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; } PathTarget;
/* Convenience macro to get a sort/group refno from a PathTarget */ /* Convenience macro to get a sort/group refno from a PathTarget */
@ -1189,24 +1339,32 @@ typedef struct Path
{ {
NodeTag type; NodeTag type;
NodeTag pathtype; /* tag identifying scan/join method */ /* tag identifying scan/join method */
NodeTag pathtype;
RelOptInfo *parent; /* the relation this path can build */ /* the relation this path can build */
PathTarget *pathtarget; /* list of Vars/Exprs, cost, width */ 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? */ /* parameterization info, or NULL if none */
bool parallel_safe; /* OK to use as part of parallel plan? */ ParamPathInfo *param_info;
int parallel_workers; /* desired # of workers; 0 = not parallel */
/* 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) */ /* estimated size/costs for path (see costsize.c for more info) */
Cardinality rows; /* estimated number of result tuples */ Cardinality rows; /* estimated number of result tuples */
Cost startup_cost; /* cost expended before fetching any tuples */ Cost startup_cost; /* cost expended before fetching any tuples */
Cost total_cost; /* total cost (assuming all tuples fetched) */ Cost total_cost; /* total cost (assuming all tuples fetched) */
List *pathkeys; /* sort ordering of path's output */ /* sort ordering of path's output; a List of PathKey nodes; see above */
/* pathkeys is a List of PathKey nodes; see above */ List *pathkeys;
} Path; } Path;
/* Macro for extracting a path's parameterization relids; beware double eval */ /* Macro for extracting a path's parameterization relids; beware double eval */
@ -2072,22 +2230,29 @@ typedef struct RestrictInfo
{ {
NodeTag type; 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 /* to indicate if clause contains any volatile functions. */
* 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: */ /* The set of relids (varnos) actually referenced in the clause: */
Relids clause_relids; Relids clause_relids;
@ -2101,45 +2266,84 @@ typedef struct RestrictInfo
/* The relids used in the clause that are nullable by lower outer joins: */ /* The relids used in the clause that are nullable by lower outer joins: */
Relids nullable_relids; Relids nullable_relids;
/* These fields are set for any binary opclause: */ /*
Relids left_relids; /* relids in left side of clause */ * Relids in the left/right side of the clause. These fields are set for
Relids right_relids; /* relids in right side of clause */ * 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 */ * cache space for cost and selectivity
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 */
/* valid if clause is mergejoinable, else NIL */ /* eval cost of clause; -1 if not yet set */
List *mergeopfamilies; /* opfamilies containing clause operator */ QualCost eval_cost;
/* cache space for mergeclause processing; NULL if not yet set */ /*
EquivalenceClass *left_ec; /* EquivalenceClass containing lefthand */ * selectivity for "normal" (JOIN_INNER) semantics; -1 if not yet set; >1
EquivalenceClass *right_ec; /* EquivalenceClass containing righthand */ * means a redundant clause
EquivalenceMember *left_em; /* EquivalenceMember for lefthand */ */
EquivalenceMember *right_em; /* EquivalenceMember for righthand */ Selectivity norm_selec;
List *scansel_cache; /* list of MergeScanSelCache structs */ /* selectivity for outer join semantics; -1 if not yet set */
Selectivity outer_selec;
/* transient workspace for use while considering a specific join path */ /*
bool outer_is_left; /* T = outer var on left, F = on right */ * opfamilies containing clause operator; valid if clause is
* mergejoinable, else NIL
*/
List *mergeopfamilies;
/* valid if clause is hashjoinable, else InvalidOid: */ /*
Oid hashjoinoperator; /* copy of clause operator */ * cache space for mergeclause processing; NULL if not yet set
*/
/* cache space for hashclause processing; -1 if not yet set */ /* EquivalenceClass containing lefthand */
Selectivity left_bucketsize; /* avg bucketsize of left side */ EquivalenceClass *left_ec;
Selectivity right_bucketsize; /* avg bucketsize of right side */ /* EquivalenceClass containing righthand */
Selectivity left_mcvfreq; /* left side's most common val's freq */ EquivalenceClass *right_ec;
Selectivity right_mcvfreq; /* right side's most common val's freq */ /* EquivalenceMember for lefthand */
EquivalenceMember *left_em;
/* EquivalenceMember for righthand */
EquivalenceMember *right_em;
/* list of MergeScanSelCache structs */
List *scansel_cache;
/*
* 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 */ /* hash equality operators used for memoize nodes, else InvalidOid */
Oid left_hasheqoperator; Oid left_hasheqoperator;
@ -2198,10 +2402,18 @@ typedef struct MergeScanSelCache
typedef struct PlaceHolderVar typedef struct PlaceHolderVar
{ {
Expr xpr; Expr xpr;
Expr *phexpr; /* the represented expression */
Relids phrels; /* base relids syntactically within expr src */ /* the represented expression */
Index phid; /* ID for PHV (unique within planner run) */ Expr *phexpr;
Index phlevelsup; /* > 0 if PHV belongs to outer query */
/* 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; } PlaceHolderVar;
/* /*
@ -2360,7 +2572,7 @@ typedef struct AppendRelInfo
* child column is dropped or doesn't exist in the parent. * child column is dropped or doesn't exist in the parent.
*/ */
int num_child_cols; /* length of array */ 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 * We store the parent table's OID here for inheritance, or InvalidOid for
@ -2428,12 +2640,23 @@ typedef struct PlaceHolderInfo
{ {
NodeTag type; NodeTag type;
Index phid; /* ID for PH (unique within planner run) */ /* ID for PH (unique within planner run) */
PlaceHolderVar *ph_var; /* copy of PlaceHolderVar tree */ Index phid;
Relids ph_eval_at; /* lowest level we can evaluate value at */
Relids ph_lateral; /* relids of contained lateral refs, if any */ /* copy of PlaceHolderVar tree */
Relids ph_needed; /* highest level the value is needed at */ PlaceHolderVar *ph_var;
int32 ph_width; /* estimated attribute width */
/* 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; } PlaceHolderInfo;
/* /*
@ -2445,13 +2668,26 @@ typedef struct MinMaxAggInfo
{ {
NodeTag type; NodeTag type;
Oid aggfnoid; /* pg_proc Oid of the aggregate */ /* pg_proc Oid of the aggregate */
Oid aggsortop; /* Oid of its sort operator */ Oid aggfnoid;
Expr *target; /* expression we are aggregating on */
PlannerInfo *subroot; /* modified "root" for planning the subquery */ /* Oid of its sort operator */
Path *path; /* access path for subquery */ Oid aggsortop;
Cost pathcost; /* estimated cost to fetch first row */
Param *param; /* param for subplan's output */ /* 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; } MinMaxAggInfo;
/* /*

View File

@ -274,14 +274,29 @@ typedef struct Append
typedef struct MergeAppend typedef struct MergeAppend
{ {
Plan plan; Plan plan;
Bitmapset *apprelids; /* RTIs of appendrel(s) formed by this node */
/* RTIs of appendrel(s) formed by this node */
Bitmapset *apprelids;
List *mergeplans; List *mergeplans;
/* these fields are just like the sort-key info in struct Sort: */ /* 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 */ /* number of sort-key columns */
Oid *sortOperators; /* OIDs of operators to sort them by */ int numCols;
Oid *collations; /* OIDs of collations */
bool *nullsFirst; /* NULLS FIRST/LAST directions */ /* 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 */ /* Info for run-time subplan pruning; NULL if we're not doing that */
struct PartitionPruneInfo *part_prune_info; struct PartitionPruneInfo *part_prune_info;
} MergeAppend; } MergeAppend;
@ -297,14 +312,24 @@ typedef struct MergeAppend
typedef struct RecursiveUnion typedef struct RecursiveUnion
{ {
Plan plan; 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 */ /* Remaining fields are zero/null in UNION ALL case */
int numCols; /* number of columns to check for
* duplicate-ness */ /* number of columns to check for duplicate-ness */
AttrNumber *dupColIdx; /* their indexes in the target list */ int numCols;
Oid *dupOperators; /* equality operators to compare with */
/* their indexes in the target list */
AttrNumber *dupColIdx;
/* equality operators to compare with */
Oid *dupOperators;
Oid *dupCollations; Oid *dupCollations;
long numGroups; /* estimated number of groups in input */
/* estimated number of groups in input */
long numGroups;
} RecursiveUnion; } RecursiveUnion;
/* ---------------- /* ----------------
@ -777,13 +802,26 @@ typedef struct NestLoopParam
typedef struct MergeJoin typedef struct MergeJoin
{ {
Join join; 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: */ /* 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 */ /* per-clause OIDs of btree opfamilies */
int *mergeStrategies; /* per-clause ordering (ASC or DESC) */ Oid *mergeFamilies;
bool *mergeNullsFirst; /* per-clause nulls ordering */
/* per-clause OIDs of collations */
Oid *mergeCollations;
/* per-clause ordering (ASC or DESC) */
int *mergeStrategies;
/* per-clause nulls ordering */
bool *mergeNullsFirst;
} MergeJoin; } MergeJoin;
/* ---------------- /* ----------------
@ -821,21 +859,38 @@ typedef struct Memoize
{ {
Plan plan; Plan plan;
int numKeys; /* size of the two arrays below */ /* size of the two arrays below */
int numKeys;
Oid *hashOperators; /* hash operators for each key */ /* hash operators for each key */
Oid *collations; /* collations for each key */ Oid *hashOperators;
List *param_exprs; /* cache keys in the form of exprs containing
* parameters */ /* collations for each key */
bool singlerow; /* true if the cache entry should be marked as Oid *collations;
* complete after we store the first tuple in
* it. */ /* cache keys in the form of exprs containing parameters */
bool binary_mode; /* true when cache key should be compared bit List *param_exprs;
* 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 * true if the cache entry should be marked as complete after we store the
* if unknown */ * first tuple in it.
Bitmapset *keyparamids; /* paramids from param_exprs */ */
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; } Memoize;
/* ---------------- /* ----------------
@ -845,11 +900,21 @@ typedef struct Memoize
typedef struct Sort typedef struct Sort
{ {
Plan plan; Plan plan;
int numCols; /* number of sort-key columns */
AttrNumber *sortColIdx; /* their indexes in the target list */ /* number of sort-key columns */
Oid *sortOperators; /* OIDs of operators to sort them by */ int numCols;
Oid *collations; /* OIDs of collations */
bool *nullsFirst; /* NULLS FIRST/LAST directions */ /* 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; } Sort;
/* ---------------- /* ----------------
@ -871,9 +936,15 @@ typedef struct IncrementalSort
typedef struct Group typedef struct Group
{ {
Plan plan; Plan plan;
int numCols; /* number of grouping columns */
AttrNumber *grpColIdx; /* their indexes in the target list */ /* number of grouping columns */
Oid *grpOperators; /* equality operators to compare with */ int numCols;
/* their indexes in the target list */
AttrNumber *grpColIdx;
/* equality operators to compare with */
Oid *grpOperators;
Oid *grpCollations; Oid *grpCollations;
} Group; } Group;
@ -894,18 +965,39 @@ typedef struct Group
typedef struct Agg typedef struct Agg
{ {
Plan plan; Plan plan;
AggStrategy aggstrategy; /* basic strategy, see nodes.h */
AggSplit aggsplit; /* agg-splitting mode, see nodes.h */ /* basic strategy, see nodes.h */
int numCols; /* number of grouping columns */ AggStrategy aggstrategy;
AttrNumber *grpColIdx; /* their indexes in the target list */
Oid *grpOperators; /* equality operators to compare with */ /* 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; Oid *grpCollations;
long numGroups; /* estimated number of groups in input */
uint64 transitionSpace; /* for pass-by-ref transition data */ /* estimated number of groups in input */
Bitmapset *aggParams; /* IDs of Params used in Aggref inputs */ 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 */ /* 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; } Agg;
/* ---------------- /* ----------------
@ -915,28 +1007,71 @@ typedef struct Agg
typedef struct WindowAgg typedef struct WindowAgg
{ {
Plan plan; Plan plan;
Index winref; /* ID referenced by window functions */
int partNumCols; /* number of columns in partition clause */ /* ID referenced by window functions */
AttrNumber *partColIdx; /* their indexes in the target list */ Index winref;
Oid *partOperators; /* equality operators for partition columns */
Oid *partCollations; /* collations for partition columns */ /* number of columns in partition clause */
int ordNumCols; /* number of columns in ordering clause */ int partNumCols;
AttrNumber *ordColIdx; /* their indexes in the target list */
Oid *ordOperators; /* equality operators for ordering columns */ /* their indexes in the target list */
Oid *ordCollations; /* collations for ordering columns */ AttrNumber *partColIdx;
int frameOptions; /* frame_clause options, see WindowDef */
Node *startOffset; /* expression for starting bound, if any */ /* equality operators for partition columns */
Node *endOffset; /* expression for ending bound, if any */ Oid *partOperators;
List *runCondition; /* qual to help short-circuit execution */
List *runConditionOrig; /* runCondition for display in EXPLAIN */ /* 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: */ /* these fields are used with RANGE offset PRECEDING/FOLLOWING: */
Oid startInRangeFunc; /* in_range function for startOffset */
Oid endInRangeFunc; /* in_range function for endOffset */ /* in_range function for startOffset */
Oid inRangeColl; /* collation for in_range tests */ Oid startInRangeFunc;
bool inRangeAsc; /* use ASC sort order for in_range tests? */
bool inRangeNullsFirst; /* nulls sort first for in_range tests? */ /* in_range function for endOffset */
bool topWindow; /* false for all apart from the WindowAgg Oid endInRangeFunc;
* that's closest to the root of the plan */
/* 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; } WindowAgg;
/* ---------------- /* ----------------
@ -946,10 +1081,18 @@ typedef struct WindowAgg
typedef struct Unique typedef struct Unique
{ {
Plan plan; Plan plan;
int numCols; /* number of columns to check for uniqueness */
AttrNumber *uniqColIdx; /* their indexes in the target list */ /* number of columns to check for uniqueness */
Oid *uniqOperators; /* equality operators to compare with */ int numCols;
Oid *uniqCollations; /* collations for equality comparisons */
/* their indexes in the target list */
AttrNumber *uniqColIdx;
/* equality operators to compare with */
Oid *uniqOperators;
/* collations for equality comparisons */
Oid *uniqCollations;
} Unique; } Unique;
/* ------------ /* ------------
@ -981,16 +1124,35 @@ typedef struct Gather
typedef struct GatherMerge typedef struct GatherMerge
{ {
Plan plan; 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 */ /* 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 */ /* number of sort-key columns */
Oid *sortOperators; /* OIDs of operators to sort them by */ int numCols;
Oid *collations; /* OIDs of collations */
bool *nullsFirst; /* NULLS FIRST/LAST directions */ /* their indexes in the target list */
Bitmapset *initParam; /* param id's of initplans which are referred AttrNumber *sortColIdx;
* at gather merge or one of it's child node */
/* 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; } GatherMerge;
/* ---------------- /* ----------------
@ -1024,16 +1186,31 @@ typedef struct Hash
typedef struct SetOp typedef struct SetOp
{ {
Plan plan; Plan plan;
SetOpCmd cmd; /* what to do, see nodes.h */
SetOpStrategy strategy; /* how to do it, see nodes.h */ /* what to do, see nodes.h */
int numCols; /* number of columns to check for SetOpCmd cmd;
* duplicate-ness */
AttrNumber *dupColIdx; /* their indexes in the target list */ /* how to do it, see nodes.h */
Oid *dupOperators; /* equality operators to compare with */ 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; Oid *dupCollations;
AttrNumber flagColIdx; /* where is the flag column, if any */
int firstFlag; /* flag value for first input relation */ /* where is the flag column, if any */
long numGroups; /* estimated number of groups in input */ AttrNumber flagColIdx;
/* flag value for first input relation */
int firstFlag;
/* estimated number of groups in input */
long numGroups;
} SetOp; } SetOp;
/* ---------------- /* ----------------
@ -1062,13 +1239,27 @@ typedef struct LockRows
typedef struct Limit typedef struct Limit
{ {
Plan plan; Plan plan;
Node *limitOffset; /* OFFSET parameter, or NULL if none */
Node *limitCount; /* COUNT parameter, or NULL if none */ /* OFFSET parameter, or NULL if none */
LimitOption limitOption; /* limit type */ Node *limitOffset;
int uniqNumCols; /* number of columns to check for similarity */
AttrNumber *uniqColIdx; /* their indexes in the target list */ /* COUNT parameter, or NULL if none */
Oid *uniqOperators; /* equality operators to compare with */ Node *limitCount;
Oid *uniqCollations; /* collations for equality comparisons */
/* 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; } Limit;
@ -1223,13 +1414,24 @@ typedef struct PartitionPruneInfo
typedef struct PartitionedRelPruneInfo typedef struct PartitionedRelPruneInfo
{ {
NodeTag type; NodeTag type;
Index rtindex; /* RT index of partition rel for this level */
Bitmapset *present_parts; /* Indexes of all partitions which subplans or /* RT index of partition rel for this level */
* subparts are present for */ Index rtindex;
int nparts; /* Length of the following arrays: */
int *subplan_map; /* subplan index by partition index, or -1 */ /* Indexes of all partitions which subplans or subparts are present for */
int *subpart_map; /* subpart index by partition index, or -1 */ Bitmapset *present_parts;
Oid *relid_map; /* relation OID by partition index, or 0 */
/* 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., * 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 *initial_pruning_steps; /* List of PartitionPruneStep */
List *exec_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; } PartitionedRelPruneInfo;
/* /*

View File

@ -63,14 +63,27 @@ typedef enum OnCommitAction
typedef struct RangeVar typedef struct RangeVar
{ {
NodeTag type; NodeTag type;
char *catalogname; /* the catalog (database) name, or NULL */
char *schemaname; /* the schema name, or NULL */ /* the catalog (database) name, or NULL */
char *relname; /* the relation/sequence name */ char *catalogname;
bool inh; /* expand rel by inheritance? recursively act
* on children? */ /* the schema name, or NULL */
char relpersistence; /* see RELPERSISTENCE_* in pg_class.h */ char *schemaname;
Alias *alias; /* table alias & optional column aliases */
int location; /* token location, or -1 if unknown */ /* the relation/sequence name */
char *relname;
/* expand rel by inheritance? recursively act on children? */
bool inh;
/* see RELPERSISTENCE_* in pg_class.h */
char relpersistence;
/* table alias & optional column aliases */
Alias *alias;
/* token location, or -1 if unknown */
int location;
} RangeVar; } RangeVar;
typedef enum TableFuncType typedef enum TableFuncType
@ -195,19 +208,38 @@ typedef struct Expr
typedef struct Var typedef struct Var
{ {
Expr xpr; Expr xpr;
int varno; /* index of this var's relation in the range
* table, or INNER_VAR/OUTER_VAR/etc */ /*
AttrNumber varattno; /* attribute number of this var, or zero for * index of this var's relation in the range table, or
* all attrs ("whole-row Var") */ * INNER_VAR/OUTER_VAR/etc
Oid vartype; /* pg_type OID for the type of this var */ */
int32 vartypmod; /* pg_attribute typmod value */ int varno;
Oid varcollid; /* OID of collation, or InvalidOid if none */
Index varlevelsup; /* for subquery variables referencing outer /*
* relations; 0 in a normal var, >0 means N * attribute number of this var, or zero for all attrs ("whole-row Var")
* levels up */ */
Index varnosyn; /* syntactic relation index (0 if unknown) */ AttrNumber varattno;
AttrNumber varattnosyn; /* syntactic attribute number */
int location; /* token location, or -1 if unknown */ /* pg_type OID for the type of this var */
Oid vartype;
/* pg_attribute typmod value */
int32 vartypmod;
/* OID of collation, or InvalidOid if none */
Oid varcollid;
/*
* for subquery variables referencing outer relations; 0 in a normal var,
* >0 means N levels up
*/
Index varlevelsup;
/* syntactic relation index (0 if unknown) */
Index varnosyn;
/* syntactic attribute number */
AttrNumber varattnosyn;
/* token location, or -1 if unknown */
int location;
} Var; } Var;
/* /*
@ -329,26 +361,66 @@ typedef struct Param
typedef struct Aggref typedef struct Aggref
{ {
Expr xpr; Expr xpr;
Oid aggfnoid; /* pg_proc Oid of the aggregate */
Oid aggtype; /* type Oid of result of the aggregate */ /* pg_proc Oid of the aggregate */
Oid aggcollid; /* OID of collation of result */ Oid aggfnoid;
Oid inputcollid; /* OID of collation that function should use */
Oid aggtranstype; /* type Oid of aggregate's transition value */ /* type Oid of result of the aggregate */
List *aggargtypes; /* type Oids of direct and aggregated args */ Oid aggtype;
List *aggdirectargs; /* direct arguments, if an ordered-set agg */
List *args; /* aggregated arguments and sort expressions */ /* OID of collation of result */
List *aggorder; /* ORDER BY (list of SortGroupClause) */ Oid aggcollid;
List *aggdistinct; /* DISTINCT (list of SortGroupClause) */
Expr *aggfilter; /* FILTER expression, if any */ /* OID of collation that function should use */
bool aggstar; /* true if argument list was really '*' */ Oid inputcollid;
bool aggvariadic; /* true if variadic arguments have been
* combined into an array last argument */ /* type Oid of aggregate's transition value */
char aggkind; /* aggregate kind (see pg_aggregate.h) */ Oid aggtranstype;
Index agglevelsup; /* > 0 if agg belongs to outer query */
AggSplit aggsplit; /* expected agg-splitting mode of parent Agg */ /* type Oids of direct and aggregated args */
int aggno; /* unique ID within the Agg node */ List *aggargtypes;
int aggtransno; /* unique ID of transition state in the Agg */
int location; /* token location, or -1 if unknown */ /* 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; } Aggref;
/* /*
@ -378,12 +450,21 @@ typedef struct Aggref
typedef struct GroupingFunc typedef struct GroupingFunc
{ {
Expr xpr; Expr xpr;
List *args; /* arguments, not evaluated but kept for
* benefit of EXPLAIN etc. */ /* arguments, not evaluated but kept for benefit of EXPLAIN etc. */
List *refs; /* ressortgrouprefs of arguments */ List *args;
List *cols; /* actual column positions set by planner */
Index agglevelsup; /* same as Aggref.agglevelsup */ /* ressortgrouprefs of arguments */
int location; /* token location */ List *refs;
/* actual column positions set by planner */
List *cols;
/* same as Aggref.agglevelsup */
Index agglevelsup;
/* token location */
int location;
} GroupingFunc; } GroupingFunc;
/* /*
@ -548,14 +629,30 @@ typedef struct NamedArgExpr
typedef struct OpExpr typedef struct OpExpr
{ {
Expr xpr; Expr xpr;
Oid opno; /* PG_OPERATOR OID of the operator */
Oid opfuncid; /* PG_PROC OID of underlying function */ /* PG_OPERATOR OID of the operator */
Oid opresulttype; /* PG_TYPE OID of result value */ Oid opno;
bool opretset; /* true if operator returns set */
Oid opcollid; /* OID of collation of result */ /* PG_PROC OID of underlying function */
Oid inputcollid; /* OID of collation that operator should use */ Oid opfuncid;
List *args; /* arguments to the operator (1 or 2) */
int location; /* token location, or -1 if unknown */ /* 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; } OpExpr;
/* /*
@ -605,15 +702,30 @@ typedef OpExpr NullIfExpr;
typedef struct ScalarArrayOpExpr typedef struct ScalarArrayOpExpr
{ {
Expr xpr; Expr xpr;
Oid opno; /* PG_OPERATOR OID of the operator */
Oid opfuncid; /* PG_PROC OID of comparison function */ /* PG_OPERATOR OID of the operator */
Oid hashfuncid; /* PG_PROC OID of hash func or InvalidOid */ Oid opno;
Oid negfuncid; /* PG_PROC OID of negator of opfuncid function
* or InvalidOid. See above */ /* PG_PROC OID of comparison function */
bool useOr; /* true for ANY, false for ALL */ Oid opfuncid;
Oid inputcollid; /* OID of collation that operator should use */
List *args; /* the scalar and array operands */ /* PG_PROC OID of hash func or InvalidOid */
int location; /* token location, or -1 if unknown */ 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; } ScalarArrayOpExpr;
/* /*