aboutsummaryrefslogtreecommitdiff
path: root/src/include/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/nodes')
-rw-r--r--src/include/nodes/execnodes.h68
-rw-r--r--src/include/nodes/meson.build2
-rw-r--r--src/include/nodes/parsenodes.h55
-rw-r--r--src/include/nodes/pathnodes.h16
-rw-r--r--src/include/nodes/plannodes.h28
-rw-r--r--src/include/nodes/primnodes.h6
-rw-r--r--src/include/nodes/queryjumble.h19
7 files changed, 139 insertions, 55 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index 2492282213f..e107d6e5f81 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -157,34 +157,6 @@ typedef struct ExprState
* entries for a particular index. Used for both index_build and
* retail creation of index entries.
*
- * NumIndexAttrs total number of columns in this index
- * NumIndexKeyAttrs number of key columns in index
- * IndexAttrNumbers underlying-rel attribute numbers used as keys
- * (zeroes indicate expressions). It also contains
- * info about included columns.
- * Expressions expr trees for expression entries, or NIL if none
- * ExpressionsState exec state for expressions, or NIL if none
- * Predicate partial-index predicate, or NIL if none
- * PredicateState exec state for predicate, or NIL if none
- * ExclusionOps Per-column exclusion operators, or NULL if none
- * ExclusionProcs Underlying function OIDs for ExclusionOps
- * ExclusionStrats Opclass strategy numbers for ExclusionOps
- * UniqueOps These are like Exclusion*, but for unique indexes
- * UniqueProcs
- * UniqueStrats
- * Unique is it a unique index?
- * OpclassOptions opclass-specific options, or NULL if none
- * ReadyForInserts is it valid for inserts?
- * CheckedUnchanged IndexUnchanged status determined yet?
- * IndexUnchanged aminsert hint, cached for retail inserts
- * Concurrent are we doing a concurrent index build?
- * BrokenHotChain did we detect any broken HOT chains?
- * Summarizing is it a summarizing index?
- * ParallelWorkers # of workers requested (excludes leader)
- * Am Oid of index AM
- * AmCache private cache area for index AM
- * Context memory context holding this IndexInfo
- *
* ii_Concurrent, ii_BrokenHotChain, and ii_ParallelWorkers are used only
* during index build; they're conventionally zeroed otherwise.
* ----------------
@@ -192,31 +164,67 @@ typedef struct ExprState
typedef struct IndexInfo
{
NodeTag type;
- int ii_NumIndexAttrs; /* total number of columns in index */
- int ii_NumIndexKeyAttrs; /* number of key columns in index */
+
+ /* total number of columns in index */
+ int ii_NumIndexAttrs;
+ /* number of key columns in index */
+ int ii_NumIndexKeyAttrs;
+
+ /*
+ * Underlying-rel attribute numbers used as keys (zeroes indicate
+ * expressions). It also contains info about included columns.
+ */
AttrNumber ii_IndexAttrNumbers[INDEX_MAX_KEYS];
+
+ /* expr trees for expression entries, or NIL if none */
List *ii_Expressions; /* list of Expr */
+ /* exec state for expressions, or NIL if none */
List *ii_ExpressionsState; /* list of ExprState */
+
+ /* partial-index predicate, or NIL if none */
List *ii_Predicate; /* list of Expr */
+ /* exec state for expressions, or NIL if none */
ExprState *ii_PredicateState;
+
+ /* Per-column exclusion operators, or NULL if none */
Oid *ii_ExclusionOps; /* array with one entry per column */
+ /* Underlying function OIDs for ExclusionOps */
Oid *ii_ExclusionProcs; /* array with one entry per column */
+ /* Opclass strategy numbers for ExclusionOps */
uint16 *ii_ExclusionStrats; /* array with one entry per column */
+
+ /* These are like Exclusion*, but for unique indexes */
Oid *ii_UniqueOps; /* array with one entry per column */
Oid *ii_UniqueProcs; /* array with one entry per column */
uint16 *ii_UniqueStrats; /* array with one entry per column */
+
+ /* is it a unique index? */
bool ii_Unique;
+ /* is NULLS NOT DISTINCT? */
bool ii_NullsNotDistinct;
+ /* is it valid for inserts? */
bool ii_ReadyForInserts;
+ /* IndexUnchanged status determined yet? */
bool ii_CheckedUnchanged;
+ /* aminsert hint, cached for retail inserts */
bool ii_IndexUnchanged;
+ /* are we doing a concurrent index build? */
bool ii_Concurrent;
+ /* did we detect any broken HOT chains? */
bool ii_BrokenHotChain;
+ /* is it a summarizing index? */
bool ii_Summarizing;
+ /* is it a WITHOUT OVERLAPS index? */
bool ii_WithoutOverlaps;
+ /* # of workers requested (excludes leader) */
int ii_ParallelWorkers;
+
+ /* Oid of index AM */
Oid ii_Am;
+ /* private cache area for index AM */
void *ii_AmCache;
+
+ /* memory context holding this IndexInfo */
MemoryContext ii_Context;
} IndexInfo;
diff --git a/src/include/nodes/meson.build b/src/include/nodes/meson.build
index d1ca24dd32f..ea36cb0fda4 100644
--- a/src/include/nodes/meson.build
+++ b/src/include/nodes/meson.build
@@ -28,7 +28,7 @@ node_support_input_i = [
node_support_input = []
foreach i : node_support_input_i
- node_support_input += meson.source_root() / 'src' / 'include' / i
+ node_support_input += meson.project_source_root() / 'src' / 'include' / i
endforeach
node_support_output = [
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index ba12678d1cb..86a236bd58b 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -2536,17 +2536,20 @@ typedef struct AlterCollationStmt
* this command.
* ----------------------
*/
+typedef enum AlterDomainType
+{
+ AD_AlterDefault = 'T', /* SET|DROP DEFAULT */
+ AD_DropNotNull = 'N', /* DROP NOT NULL */
+ AD_SetNotNull = 'O', /* SET NOT NULL */
+ AD_AddConstraint = 'C', /* ADD CONSTRAINT */
+ AD_DropConstraint = 'X', /* DROP CONSTRAINT */
+ AD_ValidateConstraint = 'V', /* VALIDATE CONSTRAINT */
+} AlterDomainType;
+
typedef struct AlterDomainStmt
{
NodeTag type;
- char subtype; /*------------
- * T = alter column default
- * N = alter column drop not null
- * O = alter column set not null
- * C = add constraint
- * X = drop constraint
- *------------
- */
+ AlterDomainType subtype; /* subtype of command */
List *typeName; /* domain to work on */
char *name; /* column or constraint name to act on */
Node *def; /* definition of default or constraint */
@@ -3422,15 +3425,44 @@ typedef enum FetchDirection
FETCH_RELATIVE,
} FetchDirection;
+typedef enum FetchDirectionKeywords
+{
+ FETCH_KEYWORD_NONE = 0,
+ FETCH_KEYWORD_NEXT,
+ FETCH_KEYWORD_PRIOR,
+ FETCH_KEYWORD_FIRST,
+ FETCH_KEYWORD_LAST,
+ FETCH_KEYWORD_ABSOLUTE,
+ FETCH_KEYWORD_RELATIVE,
+ FETCH_KEYWORD_ALL,
+ FETCH_KEYWORD_FORWARD,
+ FETCH_KEYWORD_FORWARD_ALL,
+ FETCH_KEYWORD_BACKWARD,
+ FETCH_KEYWORD_BACKWARD_ALL,
+} FetchDirectionKeywords;
+
#define FETCH_ALL LONG_MAX
typedef struct FetchStmt
{
NodeTag type;
FetchDirection direction; /* see above */
- long howMany; /* number of rows, or position argument */
- char *portalname; /* name of portal (cursor) */
- bool ismove; /* true if MOVE */
+ /* number of rows, or position argument */
+ long howMany pg_node_attr(query_jumble_ignore);
+ /* name of portal (cursor) */
+ char *portalname;
+ /* true if MOVE */
+ bool ismove;
+
+ /*
+ * Set when a direction_keyword (e.g., FETCH FORWARD) is used, to
+ * distinguish it from a numeric variant (e.g., FETCH 1) for the purpose
+ * of query jumbling.
+ */
+ FetchDirectionKeywords direction_keyword;
+
+ /* token location, or -1 if unknown */
+ ParseLoc location pg_node_attr(query_jumble_location);
} FetchStmt;
/* ----------------------
@@ -4015,6 +4047,7 @@ typedef struct RefreshMatViewStmt
typedef struct CheckPointStmt
{
NodeTag type;
+ List *options; /* list of DefElem nodes */
} CheckPointStmt;
/* ----------------------
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
index 6567759595d..ad2726f026f 100644
--- a/src/include/nodes/pathnodes.h
+++ b/src/include/nodes/pathnodes.h
@@ -179,6 +179,9 @@ typedef struct PlannerGlobal
/* partition descriptors */
PartitionDirectory partition_directory pg_node_attr(read_write_ignore);
+
+ /* hash table for NOT NULL attnums of relations */
+ struct HTAB *rel_notnullatts_hash pg_node_attr(read_write_ignore);
} PlannerGlobal;
/* macro for fetching the Plan associated with a SubPlan node */
@@ -719,6 +722,9 @@ typedef struct PartitionSchemeData *PartitionScheme;
* the attribute is needed as part of final targetlist
* attr_widths - cache space for per-attribute width estimates;
* zero means not computed yet
+ * notnullattnums - zero-based set containing attnums of NOT NULL
+ * columns (not populated for rels corresponding to
+ * non-partitioned inh==true RTEs)
* nulling_relids - relids of outer joins that can null this rel
* lateral_vars - lateral cross-references of rel, if any (list of
* Vars and PlaceHolderVars)
@@ -952,11 +958,7 @@ typedef struct RelOptInfo
Relids *attr_needed pg_node_attr(read_write_ignore);
/* array indexed [min_attr .. max_attr] */
int32 *attr_widths pg_node_attr(read_write_ignore);
-
- /*
- * Zero-based set containing attnums of NOT NULL columns. Not populated
- * for rels corresponding to non-partitioned inh==true RTEs.
- */
+ /* zero-based set containing attnums of NOT NULL columns */
Bitmapset *notnullattnums;
/* relids of outer joins that can null this baserel */
Relids nulling_relids;
@@ -2131,10 +2133,12 @@ typedef struct MemoizePath
* complete after caching the first record. */
bool binary_mode; /* true when cache key should be compared bit
* by bit, false when using hash equality ops */
- Cardinality calls; /* expected number of rescans */
uint32 est_entries; /* The maximum number of entries that the
* planner expects will fit in the cache, or 0
* if unknown */
+ Cardinality est_calls; /* expected number of rescans */
+ Cardinality est_unique_keys; /* estimated unique keys, for EXPLAIN */
+ double est_hit_ratio; /* estimated cache hit ratio, for EXPLAIN */
} MemoizePath;
/*
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index 4f59e30d62d..29d7732d6a0 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.h
@@ -29,6 +29,21 @@
*/
/* ----------------
+ * PlannedStmtOrigin
+ *
+ * PlannedStmtOrigin identifies from where a PlannedStmt comes from.
+ * ----------------
+ */
+typedef enum PlannedStmtOrigin
+{
+ PLAN_STMT_UNKNOWN = 0, /* plan origin is not yet known */
+ PLAN_STMT_INTERNAL, /* generated internally by a query */
+ PLAN_STMT_STANDARD, /* standard planned statement */
+ PLAN_STMT_CACHE_GENERIC, /* Generic cached plan */
+ PLAN_STMT_CACHE_CUSTOM, /* Custom cached plan */
+} PlannedStmtOrigin;
+
+/* ----------------
* PlannedStmt node
*
* The output of the planner is a Plan tree headed by a PlannedStmt node.
@@ -58,6 +73,9 @@ typedef struct PlannedStmt
/* plan identifier (can be set by plugins) */
int64 planId;
+ /* origin of plan */
+ PlannedStmtOrigin planOrigin;
+
/* is it insert|update|delete|merge RETURNING? */
bool hasReturning;
@@ -1056,6 +1074,16 @@ typedef struct Memoize
/* paramids from param_exprs */
Bitmapset *keyparamids;
+
+ /* Estimated number of rescans, for EXPLAIN */
+ Cardinality est_calls;
+
+ /* Estimated number of distinct lookup keys, for EXPLAIN */
+ Cardinality est_unique_keys;
+
+ /* Estimated cache hit ratio, for EXPLAIN */
+ double est_hit_ratio;
+
} Memoize;
/* ----------------
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index 01510b01b64..6dfca3cb35b 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -389,14 +389,16 @@ typedef enum ParamKind
typedef struct Param
{
+ pg_node_attr(custom_query_jumble)
+
Expr xpr;
ParamKind paramkind; /* kind of parameter. See above */
int paramid; /* numeric ID for parameter */
Oid paramtype; /* pg_type OID of parameter's datatype */
/* typmod value, if known */
- int32 paramtypmod pg_node_attr(query_jumble_ignore);
+ int32 paramtypmod;
/* OID of collation, or InvalidOid if none */
- Oid paramcollid pg_node_attr(query_jumble_ignore);
+ Oid paramcollid;
/* token location, or -1 if unknown */
ParseLoc location;
} Param;
diff --git a/src/include/nodes/queryjumble.h b/src/include/nodes/queryjumble.h
index da7c7abed2e..dcb36dcb44f 100644
--- a/src/include/nodes/queryjumble.h
+++ b/src/include/nodes/queryjumble.h
@@ -24,11 +24,11 @@ typedef struct LocationLen
int location; /* start offset in query text */
int length; /* length in bytes, or -1 to ignore */
- /*
- * Indicates that this location represents the beginning or end of a run
- * of squashed constants.
- */
+ /* Does this location represent a squashed list? */
bool squashed;
+
+ /* Is this location a PARAM_EXTERN parameter? */
+ bool extern_param;
} LocationLen;
/*
@@ -52,9 +52,18 @@ typedef struct JumbleState
/* Current number of valid entries in clocations array */
int clocations_count;
- /* highest Param id we've seen, in order to start normalization correctly */
+ /*
+ * ID of the highest PARAM_EXTERN parameter we've seen in the query; used
+ * to start normalization correctly. However, if there are any squashed
+ * lists in the query, we disregard query-supplied parameter numbers and
+ * renumber everything. This is to avoid possible gaps caused by
+ * squashing in case any params are in squashed lists.
+ */
int highest_extern_param_id;
+ /* Whether squashable lists are present */
+ bool has_squashed_lists;
+
/*
* Count of the number of NULL nodes seen since last appending a value.
* These are flushed out to the jumble buffer before subsequent appends