summaryrefslogtreecommitdiff
path: root/src/include/nodes
diff options
context:
space:
mode:
authorBruce Momjian1997-09-07 05:04:48 +0000
committerBruce Momjian1997-09-07 05:04:48 +0000
commit1ccd423235a48739d6f7a4d7889705b5f9ecc69b (patch)
tree8001c4e839dfad8f29ceda7f8c5f5dbb8759b564 /src/include/nodes
parent8fecd4febf8357f3cc20383ed29ced484877d5ac (diff)
Massive commit to run PGINDENT on all *.c and *.h files.
Diffstat (limited to 'src/include/nodes')
-rw-r--r--src/include/nodes/execnodes.h1022
-rw-r--r--src/include/nodes/makefuncs.h60
-rw-r--r--src/include/nodes/memnodes.h117
-rw-r--r--src/include/nodes/nodeFuncs.h16
-rw-r--r--src/include/nodes/nodes.h450
-rw-r--r--src/include/nodes/params.h103
-rw-r--r--src/include/nodes/parsenodes.h1148
-rw-r--r--src/include/nodes/pg_list.h144
-rw-r--r--src/include/nodes/plannodes.h375
-rw-r--r--src/include/nodes/primnodes.h448
-rw-r--r--src/include/nodes/print.h27
-rw-r--r--src/include/nodes/readfuncs.h20
-rw-r--r--src/include/nodes/relation.h466
13 files changed, 2277 insertions, 2119 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index 7cf450785c9..870bdd80186 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* execnodes.h--
- * definitions for executor state nodes
+ * definitions for executor state nodes
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: execnodes.h,v 1.8 1997/08/27 09:04:52 vadim Exp $
+ * $Id: execnodes.h,v 1.9 1997/09/07 04:58:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,660 +23,680 @@
#include <access/funcindex.h>
/* ----------------
- * IndexInfo information
+ * IndexInfo information
*
- * this class holds the information saying what attributes
- * are the key attributes for this index. -cim 10/15/89
+ * this class holds the information saying what attributes
+ * are the key attributes for this index. -cim 10/15/89
*
- * NumKeyAttributes number of key attributes for this index
- * KeyAttributeNumbers array of attribute numbers used as keys
- * Predicate partial-index predicate for this index
+ * NumKeyAttributes number of key attributes for this index
+ * KeyAttributeNumbers array of attribute numbers used as keys
+ * Predicate partial-index predicate for this index
* ----------------
*/
-typedef struct IndexInfo {
- NodeTag type;
- int ii_NumKeyAttributes;
- AttrNumber *ii_KeyAttributeNumbers;
- FuncIndexInfoPtr ii_FuncIndexInfo;
- Node *ii_Predicate;
-} IndexInfo;
+typedef struct IndexInfo
+{
+ NodeTag type;
+ int ii_NumKeyAttributes;
+ AttrNumber *ii_KeyAttributeNumbers;
+ FuncIndexInfoPtr ii_FuncIndexInfo;
+ Node *ii_Predicate;
+} IndexInfo;
/* ----------------
- * RelationInfo information
- *
- * whenever we update an existing relation, we have to
- * update indices on the relation. The RelationInfo class
- * is used to hold all the information on result relations,
- * including indices.. -cim 10/15/89
- *
- * RangeTableIndex result relation's range table index
- * RelationDesc relation descriptor for result relation
- * NumIndices number indices existing on result relation
- * IndexRelationDescs array of relation descriptors for indices
- * IndexRelationInfo array of key/attr info for indices
+ * RelationInfo information
+ *
+ * whenever we update an existing relation, we have to
+ * update indices on the relation. The RelationInfo class
+ * is used to hold all the information on result relations,
+ * including indices.. -cim 10/15/89
+ *
+ * RangeTableIndex result relation's range table index
+ * RelationDesc relation descriptor for result relation
+ * NumIndices number indices existing on result relation
+ * IndexRelationDescs array of relation descriptors for indices
+ * IndexRelationInfo array of key/attr info for indices
* ----------------
*/
-typedef struct RelationInfo {
- NodeTag type;
- Index ri_RangeTableIndex;
- Relation ri_RelationDesc;
- int ri_NumIndices;
- RelationPtr ri_IndexRelationDescs;
- IndexInfo **ri_IndexRelationInfo;
-} RelationInfo;
+typedef struct RelationInfo
+{
+ NodeTag type;
+ Index ri_RangeTableIndex;
+ Relation ri_RelationDesc;
+ int ri_NumIndices;
+ RelationPtr ri_IndexRelationDescs;
+ IndexInfo **ri_IndexRelationInfo;
+} RelationInfo;
/* ----------------
- * ExprContext
- *
- * This class holds the "current context" information
- * needed to evaluate expressions for doing tuple qualifications
- * and tuple projections. For example, if an expression refers
- * to an attribute in the current inner tuple then we need to know
- * what the current inner tuple is and so we look at the expression
- * context.
+ * ExprContext
+ *
+ * This class holds the "current context" information
+ * needed to evaluate expressions for doing tuple qualifications
+ * and tuple projections. For example, if an expression refers
+ * to an attribute in the current inner tuple then we need to know
+ * what the current inner tuple is and so we look at the expression
+ * context.
* ----------------
*/
-typedef struct ExprContext {
- NodeTag type;
- TupleTableSlot *ecxt_scantuple;
- TupleTableSlot *ecxt_innertuple;
- TupleTableSlot *ecxt_outertuple;
- Relation ecxt_relation;
- Index ecxt_relid;
- ParamListInfo ecxt_param_list_info;
- List *ecxt_range_table;
- Datum *ecxt_values; /* precomputed values for aggreg */
- char *ecxt_nulls; /* null flags for aggreg values */
-} ExprContext;
+typedef struct ExprContext
+{
+ NodeTag type;
+ TupleTableSlot *ecxt_scantuple;
+ TupleTableSlot *ecxt_innertuple;
+ TupleTableSlot *ecxt_outertuple;
+ Relation ecxt_relation;
+ Index ecxt_relid;
+ ParamListInfo ecxt_param_list_info;
+ List *ecxt_range_table;
+ Datum *ecxt_values;/* precomputed values for aggreg */
+ char *ecxt_nulls; /* null flags for aggreg values */
+} ExprContext;
/* ----------------
- * ProjectionInfo node information
- *
- * This is all the information needed to preform projections
- * on a tuple. Nodes which need to do projections create one
- * of these. In theory, when a node wants to preform a projection
- * it should just update this information as necessary and then
- * call ExecProject(). -cim 6/3/91
- *
- * targetlist target list for projection
- * len length of target list
- * tupValue array of pointers to projection results
- * exprContext expression context for ExecTargetList
- * slot slot to place projection result in
+ * ProjectionInfo node information
+ *
+ * This is all the information needed to preform projections
+ * on a tuple. Nodes which need to do projections create one
+ * of these. In theory, when a node wants to preform a projection
+ * it should just update this information as necessary and then
+ * call ExecProject(). -cim 6/3/91
+ *
+ * targetlist target list for projection
+ * len length of target list
+ * tupValue array of pointers to projection results
+ * exprContext expression context for ExecTargetList
+ * slot slot to place projection result in
* ----------------
*/
-typedef struct ProjectionInfo {
- NodeTag type;
- List *pi_targetlist;
- int pi_len;
- Datum *pi_tupValue;
- ExprContext *pi_exprContext;
- TupleTableSlot *pi_slot;
-} ProjectionInfo;
+typedef struct ProjectionInfo
+{
+ NodeTag type;
+ List *pi_targetlist;
+ int pi_len;
+ Datum *pi_tupValue;
+ ExprContext *pi_exprContext;
+ TupleTableSlot *pi_slot;
+} ProjectionInfo;
/* ----------------
- * JunkFilter
- *
- * this class is used to store information regarding junk attributes.
- * A junk attribute is an attribute in a tuple that is needed only for
- * storing intermediate information in the executor, and does not belong
- * in the tuple proper. For example, when we do a delete or replace
- * query, the planner adds an entry to the targetlist so that the tuples
- * returned to ExecutePlan() contain an extra attribute: the t_ctid of
- * the tuple to be deleted/replaced. This is needed for amdelete() and
- * amreplace(). In doing a delete this does not make much of a
- * difference, but in doing a replace we have to make sure we disgard
- * all the junk in a tuple before calling amreplace(). Otherwise the
- * inserted tuple will not have the correct schema. This solves a
- * problem with hash-join and merge-sort replace plans. -cim 10/10/90
- *
- * targetList: the original target list (including junk attributes).
- * length: the length of 'targetList'.
- * tupType: the tuple descriptor for the "original" tuple
- * (including the junk attributes).
- * cleanTargetList: the "clean" target list (junk attributes removed).
- * cleanLength: the length of 'cleanTargetList'
- * cleanTupTyp: the tuple descriptor of the "clean" tuple (with
- * junk attributes removed).
- * cleanMap: A map with the correspondance between the non junk
- * attributes of the "original" tuple and the
- * attributes of the "clean" tuple.
+ * JunkFilter
+ *
+ * this class is used to store information regarding junk attributes.
+ * A junk attribute is an attribute in a tuple that is needed only for
+ * storing intermediate information in the executor, and does not belong
+ * in the tuple proper. For example, when we do a delete or replace
+ * query, the planner adds an entry to the targetlist so that the tuples
+ * returned to ExecutePlan() contain an extra attribute: the t_ctid of
+ * the tuple to be deleted/replaced. This is needed for amdelete() and
+ * amreplace(). In doing a delete this does not make much of a
+ * difference, but in doing a replace we have to make sure we disgard
+ * all the junk in a tuple before calling amreplace(). Otherwise the
+ * inserted tuple will not have the correct schema. This solves a
+ * problem with hash-join and merge-sort replace plans. -cim 10/10/90
+ *
+ * targetList: the original target list (including junk attributes).
+ * length: the length of 'targetList'.
+ * tupType: the tuple descriptor for the "original" tuple
+ * (including the junk attributes).
+ * cleanTargetList: the "clean" target list (junk attributes removed).
+ * cleanLength: the length of 'cleanTargetList'
+ * cleanTupTyp: the tuple descriptor of the "clean" tuple (with
+ * junk attributes removed).
+ * cleanMap: A map with the correspondance between the non junk
+ * attributes of the "original" tuple and the
+ * attributes of the "clean" tuple.
* ----------------
*/
-typedef struct JunkFilter {
- NodeTag type;
- List *jf_targetList;
- int jf_length;
- TupleDesc jf_tupType;
- List *jf_cleanTargetList;
- int jf_cleanLength;
- TupleDesc jf_cleanTupType;
- AttrNumber *jf_cleanMap;
-} JunkFilter;
+typedef struct JunkFilter
+{
+ NodeTag type;
+ List *jf_targetList;
+ int jf_length;
+ TupleDesc jf_tupType;
+ List *jf_cleanTargetList;
+ int jf_cleanLength;
+ TupleDesc jf_cleanTupType;
+ AttrNumber *jf_cleanMap;
+} JunkFilter;
/* ----------------
- * EState information
+ * EState information
*
- * direction direction of the scan
+ * direction direction of the scan
*
- * range_table array of scan relation information
+ * range_table array of scan relation information
*
- * result_relation_information for update queries
+ * result_relation_information for update queries
*
- * into_relation_descriptor relation being retrieved "into"
+ * into_relation_descriptor relation being retrieved "into"
*
- * param_list_info information needed to transform
- * Param nodes into Const nodes
+ * param_list_info information needed to transform
+ * Param nodes into Const nodes
*
- * BaseId during InitPlan(), each node is
- * given a number. this is the next
- * number to be assigned.
+ * BaseId during InitPlan(), each node is
+ * given a number. this is the next
+ * number to be assigned.
*
- * tupleTable this is a pointer to an array
- * of pointers to tuples used by
- * the executor at any given moment.
+ * tupleTable this is a pointer to an array
+ * of pointers to tuples used by
+ * the executor at any given moment.
*
- * junkFilter contains information used to
- * extract junk attributes from a tuple.
- * (see JunkFilter above)
+ * junkFilter contains information used to
+ * extract junk attributes from a tuple.
+ * (see JunkFilter above)
*
- * refcount local buffer refcounts used in
- * an ExecMain cycle. this is introduced
- * to avoid ExecStart's unpinning each
- * other's buffers when called recursively
- * ----------------
+ * refcount local buffer refcounts used in
+ * an ExecMain cycle. this is introduced
+ * to avoid ExecStart's unpinning each
+ * other's buffers when called recursively
+ * ----------------
*/
-typedef struct EState {
- NodeTag type;
- ScanDirection es_direction;
- List *es_range_table;
- RelationInfo *es_result_relation_info;
- Relation es_into_relation_descriptor;
- ParamListInfo es_param_list_info;
- int es_BaseId;
- TupleTable es_tupleTable;
- JunkFilter *es_junkFilter;
- int *es_refcount;
- uint32 es_processed; /* # of tuples processed */
- Oid es_lastoid; /* last oid processed (by INSERT) */
-} EState;
+typedef struct EState
+{
+ NodeTag type;
+ ScanDirection es_direction;
+ List *es_range_table;
+ RelationInfo *es_result_relation_info;
+ Relation es_into_relation_descriptor;
+ ParamListInfo es_param_list_info;
+ int es_BaseId;
+ TupleTable es_tupleTable;
+ JunkFilter *es_junkFilter;
+ int *es_refcount;
+ uint32 es_processed; /* # of tuples processed */
+ Oid es_lastoid; /* last oid processed (by INSERT) */
+} EState;
/* ----------------
- * Executor Type information needed by plannodes.h
- *
- *| Note: the bogus classes CommonState and CommonScanState exist only
- *| because our inheritance system only allows single inheritance
- *| and we have to have unique slot names. Hence two or more
- *| classes which want to have a common slot must ALL inherit
- *| the slot from some other class. (This is a big hack to
- *| allow our classes to share slot names..)
+ * Executor Type information needed by plannodes.h
+ *
+ *| Note: the bogus classes CommonState and CommonScanState exist only
+ *| because our inheritance system only allows single inheritance
+ *| and we have to have unique slot names. Hence two or more
+ *| classes which want to have a common slot must ALL inherit
+ *| the slot from some other class. (This is a big hack to
+ *| allow our classes to share slot names..)
*|
- *| Example:
- *| the class Result and the class NestLoop nodes both want
- *| a slot called "OuterTuple" so they both have to inherit
- *| it from some other class. In this case they inherit
- *| it from CommonState. "CommonState" and "CommonScanState" are
- *| the best names I could come up with for this sort of
- *| stuff.
+ *| Example:
+ *| the class Result and the class NestLoop nodes both want
+ *| a slot called "OuterTuple" so they both have to inherit
+ *| it from some other class. In this case they inherit
+ *| it from CommonState. "CommonState" and "CommonScanState" are
+ *| the best names I could come up with for this sort of
+ *| stuff.
*|
- *| As a result, many classes have extra slots which they
- *| don't use. These slots are denoted (unused) in the
- *| comment preceeding the class definition. If you
- *| comes up with a better idea of a way of doing things
- *| along these lines, then feel free to make your idea
- *| known to me.. -cim 10/15/89
+ *| As a result, many classes have extra slots which they
+ *| don't use. These slots are denoted (unused) in the
+ *| comment preceeding the class definition. If you
+ *| comes up with a better idea of a way of doing things
+ *| along these lines, then feel free to make your idea
+ *| known to me.. -cim 10/15/89
* ----------------
*/
/* ----------------------------------------------------------------
- * Common Executor State Information
+ * Common Executor State Information
* ----------------------------------------------------------------
*/
-/* BaseNode removed -- base_id moved into CommonState - jolly */
+/* BaseNode removed -- base_id moved into CommonState - jolly */
/* ----------------
- * CommonState information
+ * CommonState information
*
- *| this is a bogus class used to hold slots so other
- *| nodes can inherit them...
+ *| this is a bogus class used to hold slots so other
+ *| nodes can inherit them...
*
- * OuterTupleSlot pointer to slot containing current "outer" tuple
- * ResultTupleSlot pointer to slot in tuple table for projected tuple
- * ExprContext node's current expression context
- * ProjInfo info this node uses to form tuple projections
- * NumScanAttributes size of ScanAttributes array
- * ScanAttributes attribute numbers of interest in this tuple
+ * OuterTupleSlot pointer to slot containing current "outer" tuple
+ * ResultTupleSlot pointer to slot in tuple table for projected tuple
+ * ExprContext node's current expression context
+ * ProjInfo info this node uses to form tuple projections
+ * NumScanAttributes size of ScanAttributes array
+ * ScanAttributes attribute numbers of interest in this tuple
*
* ----------------
*/
-typedef struct CommonState {
- NodeTag type; /* its first field is NodeTag */
- int cs_base_id;
- TupleTableSlot *cs_OuterTupleSlot;
- TupleTableSlot *cs_ResultTupleSlot;
- ExprContext *cs_ExprContext;
- ProjectionInfo *cs_ProjInfo;
- bool cs_TupFromTlist;
-} CommonState;
+typedef struct CommonState
+{
+ NodeTag type; /* its first field is NodeTag */
+ int cs_base_id;
+ TupleTableSlot *cs_OuterTupleSlot;
+ TupleTableSlot *cs_ResultTupleSlot;
+ ExprContext *cs_ExprContext;
+ ProjectionInfo *cs_ProjInfo;
+ bool cs_TupFromTlist;
+} CommonState;
/* ----------------------------------------------------------------
- * Control Node State Information
+ * Control Node State Information
* ----------------------------------------------------------------
*/
/* ----------------
- * ResultState information
+ * ResultState information
*
- * done flag which tells us to quit when we
- * have already returned a constant tuple.
+ * done flag which tells us to quit when we
+ * have already returned a constant tuple.
*
- * CommonState information
+ * CommonState information
*
- * OuterTupleSlot pointer to slot containing current "outer" tuple
- * ResultTupleSlot pointer to slot in tuple table for projected tuple
- * ExprContext node's current expression context
- * ProjInfo info this node uses to form tuple projections
- * NumScanAttributes size of ScanAttributes array
- * ScanAttributes attribute numbers of interest in this tuple
+ * OuterTupleSlot pointer to slot containing current "outer" tuple
+ * ResultTupleSlot pointer to slot in tuple table for projected tuple
+ * ExprContext node's current expression context
+ * ProjInfo info this node uses to form tuple projections
+ * NumScanAttributes size of ScanAttributes array
+ * ScanAttributes attribute numbers of interest in this tuple
* ----------------
*/
-typedef struct ResultState {
- CommonState cstate; /* its first field is NodeTag */
- int rs_done;
-} ResultState;
+typedef struct ResultState
+{
+ CommonState cstate; /* its first field is NodeTag */
+ int rs_done;
+} ResultState;
/* ----------------
- * AppendState information
- *
- * append nodes have this field "unionplans" which is this
- * list of plans to execute in sequence.. these variables
- * keep track of things..
- *
- * whichplan which plan is being executed
- * nplans how many plans are in the list
- * initialized array of ExecInitNode() results
- * rtentries range table for the current plan
- * result_relation_info_list array of each subplan's result relation info
- * junkFilter_list array of each subplan's junk filter
- *
- * CommonState information
- *
- * OuterTupleSlot pointer to slot containing current "outer" tuple
- * ResultTupleSlot pointer to slot in tuple table for projected tuple
- * ExprContext node's current expression context
- * ProjInfo info this node uses to form tuple projections
- * NumScanAttributes size of ScanAttributes array
- * ScanAttributes attribute numbers of interest in this tuple
+ * AppendState information
+ *
+ * append nodes have this field "unionplans" which is this
+ * list of plans to execute in sequence.. these variables
+ * keep track of things..
+ *
+ * whichplan which plan is being executed
+ * nplans how many plans are in the list
+ * initialized array of ExecInitNode() results
+ * rtentries range table for the current plan
+ * result_relation_info_list array of each subplan's result relation info
+ * junkFilter_list array of each subplan's junk filter
+ *
+ * CommonState information
+ *
+ * OuterTupleSlot pointer to slot containing current "outer" tuple
+ * ResultTupleSlot pointer to slot in tuple table for projected tuple
+ * ExprContext node's current expression context
+ * ProjInfo info this node uses to form tuple projections
+ * NumScanAttributes size of ScanAttributes array
+ * ScanAttributes attribute numbers of interest in this tuple
* ----------------
*/
-typedef struct AppendState {
- CommonState cstate; /* its first field is NodeTag */
- int as_whichplan;
- int as_nplans;
- bool *as_initialized;
- List *as_rtentries;
- List *as_result_relation_info_list;
- List *as_junkFilter_list;
-} AppendState;
+typedef struct AppendState
+{
+ CommonState cstate; /* its first field is NodeTag */
+ int as_whichplan;
+ int as_nplans;
+ bool *as_initialized;
+ List *as_rtentries;
+ List *as_result_relation_info_list;
+ List *as_junkFilter_list;
+} AppendState;
/* ----------------------------------------------------------------
- * Scan State Information
+ * Scan State Information
* ----------------------------------------------------------------
*/
/* ----------------
- * CommonScanState information
+ * CommonScanState information
*
- * CommonScanState is a class like CommonState, but is used more
- * by the nodes like SeqScan and Sort which want to
- * keep track of an underlying relation.
+ * CommonScanState is a class like CommonState, but is used more
+ * by the nodes like SeqScan and Sort which want to
+ * keep track of an underlying relation.
*
- * currentRelation relation being scanned
- * currentScanDesc current scan descriptor for scan
- * ScanTupleSlot pointer to slot in tuple table holding scan tuple
+ * currentRelation relation being scanned
+ * currentScanDesc current scan descriptor for scan
+ * ScanTupleSlot pointer to slot in tuple table holding scan tuple
*
- * CommonState information
+ * CommonState information
*
- * OuterTupleSlot pointer to slot containing current "outer" tuple
- * ResultTupleSlot pointer to slot in tuple table for projected tuple
- * ExprContext node's current expression context
- * ProjInfo info this node uses to form tuple projections
- * NumScanAttributes size of ScanAttributes array
- * ScanAttributes attribute numbers of interest in this tuple
+ * OuterTupleSlot pointer to slot containing current "outer" tuple
+ * ResultTupleSlot pointer to slot in tuple table for projected tuple
+ * ExprContext node's current expression context
+ * ProjInfo info this node uses to form tuple projections
+ * NumScanAttributes size of ScanAttributes array
+ * ScanAttributes attribute numbers of interest in this tuple
* ----------------
*/
-typedef struct CommonScanState {
- CommonState cstate; /* its first field is NodeTag */
- Relation css_currentRelation;
- HeapScanDesc css_currentScanDesc;
- TupleTableSlot *css_ScanTupleSlot;
-} CommonScanState;
+typedef struct CommonScanState
+{
+ CommonState cstate; /* its first field is NodeTag */
+ Relation css_currentRelation;
+ HeapScanDesc css_currentScanDesc;
+ TupleTableSlot *css_ScanTupleSlot;
+} CommonScanState;
/* ----------------
- * IndexScanState information
- *
- *| index scans don't use CommonScanState because
- *| the underlying AM abstractions for heap scans and
- *| index scans are too different.. It would be nice
- *| if the current abstraction was more useful but ... -cim 10/15/89
- *
- * IndexPtr current index in use
- * NumIndices number of indices in this scan
- * ScanKeys Skey structures to scan index rels
- * NumScanKeys array of no of keys in each Skey struct
- * RuntimeKeyInfo array of array of flags for Skeys evaled at runtime
- * RelationDescs ptr to array of relation descriptors
- * ScanDescs ptr to array of scan descriptors
- *
- * CommonState information
- *
- * OuterTupleSlot pointer to slot containing current "outer" tuple
- * ResultTupleSlot pointer to slot in tuple table for projected tuple
- * ExprContext node's current expression context
- * ProjInfo info this node uses to form tuple projections
- * NumScanAttributes size of ScanAttributes array
- * ScanAttributes attribute numbers of interest in this tuple
+ * IndexScanState information
+ *
+ *| index scans don't use CommonScanState because
+ *| the underlying AM abstractions for heap scans and
+ *| index scans are too different.. It would be nice
+ *| if the current abstraction was more useful but ... -cim 10/15/89
+ *
+ * IndexPtr current index in use
+ * NumIndices number of indices in this scan
+ * ScanKeys Skey structures to scan index rels
+ * NumScanKeys array of no of keys in each Skey struct
+ * RuntimeKeyInfo array of array of flags for Skeys evaled at runtime
+ * RelationDescs ptr to array of relation descriptors
+ * ScanDescs ptr to array of scan descriptors
+ *
+ * CommonState information
+ *
+ * OuterTupleSlot pointer to slot containing current "outer" tuple
+ * ResultTupleSlot pointer to slot in tuple table for projected tuple
+ * ExprContext node's current expression context
+ * ProjInfo info this node uses to form tuple projections
+ * NumScanAttributes size of ScanAttributes array
+ * ScanAttributes attribute numbers of interest in this tuple
* ----------------
*/
-typedef struct IndexScanState {
- CommonState cstate; /* its first field is NodeTag */
- int iss_NumIndices;
- int iss_IndexPtr;
- ScanKey *iss_ScanKeys;
- int *iss_NumScanKeys;
- Pointer iss_RuntimeKeyInfo;
- RelationPtr iss_RelationDescs;
- IndexScanDescPtr iss_ScanDescs;
-} IndexScanState;
+typedef struct IndexScanState
+{
+ CommonState cstate; /* its first field is NodeTag */
+ int iss_NumIndices;
+ int iss_IndexPtr;
+ ScanKey *iss_ScanKeys;
+ int *iss_NumScanKeys;
+ Pointer iss_RuntimeKeyInfo;
+ RelationPtr iss_RelationDescs;
+ IndexScanDescPtr iss_ScanDescs;
+} IndexScanState;
/* ----------------------------------------------------------------
- * Join State Information
+ * Join State Information
* ----------------------------------------------------------------
*/
/* ----------------
- * JoinState information
+ * JoinState information
*
- * CommonState information
+ * CommonState information
*
- * OuterTupleSlot pointer to slot containing current "outer" tuple
- * ResultTupleSlot pointer to slot in tuple table for projected tuple
- * ExprContext node's current expression context
- * ProjInfo info this node uses to form tuple projections
- * NumScanAttributes size of ScanAttributes array
- * ScanAttributes attribute numbers of interest in this tuple
+ * OuterTupleSlot pointer to slot containing current "outer" tuple
+ * ResultTupleSlot pointer to slot in tuple table for projected tuple
+ * ExprContext node's current expression context
+ * ProjInfo info this node uses to form tuple projections
+ * NumScanAttributes size of ScanAttributes array
+ * ScanAttributes attribute numbers of interest in this tuple
* ----------------
*/
-typedef CommonState JoinState;
+typedef CommonState JoinState;
/* ----------------
- * NestLoopState information
+ * NestLoopState information
*
- * PortalFlag Set to enable portals to work.
+ * PortalFlag Set to enable portals to work.
*
- * JoinState information
+ * JoinState information
*
- * CommonState information
+ * CommonState information
*
- * OuterTupleSlot pointer to slot containing current "outer" tuple
- * ResultTupleSlot pointer to slot in tuple table for projected tuple
- * ExprContext node's current expression context
- * ProjInfo info this node uses to form tuple projections
- * NumScanAttributes size of ScanAttributes array
- * ScanAttributes attribute numbers of interest in this tuple
+ * OuterTupleSlot pointer to slot containing current "outer" tuple
+ * ResultTupleSlot pointer to slot in tuple table for projected tuple
+ * ExprContext node's current expression context
+ * ProjInfo info this node uses to form tuple projections
+ * NumScanAttributes size of ScanAttributes array
+ * ScanAttributes attribute numbers of interest in this tuple
* ----------------
*/
-typedef struct NestLoopState {
- JoinState jstate; /* its first field is NodeTag */
- bool nl_PortalFlag;
-} NestLoopState;
+typedef struct NestLoopState
+{
+ JoinState jstate; /* its first field is NodeTag */
+ bool nl_PortalFlag;
+} NestLoopState;
/* ----------------
- * MergeJoinState information
+ * MergeJoinState information
*
- * OSortopI outerKey1 sortOp innerKey1 ...
- * ISortopO innerkey1 sortOp outerkey1 ...
- * JoinState current "state" of join. see executor.h
- * MarkedTupleSlot pointer to slot in tuple table for marked tuple
+ * OSortopI outerKey1 sortOp innerKey1 ...
+ * ISortopO innerkey1 sortOp outerkey1 ...
+ * JoinState current "state" of join. see executor.h
+ * MarkedTupleSlot pointer to slot in tuple table for marked tuple
*
- * JoinState information
+ * JoinState information
*
- * CommonState information
+ * CommonState information
*
- * OuterTupleSlot pointer to slot containing current "outer" tuple
- * ResultTupleSlot pointer to slot in tuple table for projected tuple
- * ExprContext node's current expression context
- * ProjInfo info this node uses to form tuple projections
- * NumScanAttributes size of ScanAttributes array
- * ScanAttributes attribute numbers of interest in this tuple
+ * OuterTupleSlot pointer to slot containing current "outer" tuple
+ * ResultTupleSlot pointer to slot in tuple table for projected tuple
+ * ExprContext node's current expression context
+ * ProjInfo info this node uses to form tuple projections
+ * NumScanAttributes size of ScanAttributes array
+ * ScanAttributes attribute numbers of interest in this tuple
* ----------------
*/
-typedef struct MergeJoinState {
- JoinState jstate; /* its first field is NodeTag */
- List *mj_OSortopI;
- List *mj_ISortopO;
- int mj_JoinState;
- TupleTableSlot *mj_MarkedTupleSlot;
-} MergeJoinState;
+typedef struct MergeJoinState
+{
+ JoinState jstate; /* its first field is NodeTag */
+ List *mj_OSortopI;
+ List *mj_ISortopO;
+ int mj_JoinState;
+ TupleTableSlot *mj_MarkedTupleSlot;
+} MergeJoinState;
/* ----------------
- * HashJoinState information
- *
- * hj_HashTable address of the hash table for the hashjoin
- * hj_HashTableShmId shared memory id of hash table
- * hj_CurBucket the current hash bucket that we are searching
- * for matches of the current outer tuple
- * hj_CurTuple the current matching inner tuple in the
- * current hash bucket
- * hj_CurOTuple the current matching inner tuple in the
- * current hash overflow chain
- * hj_InnerHashKey the inner hash key in the hashjoin condition
- * hj_OuterBatches file descriptors for outer batches
- * hj_InnerBatches file descriptors for inner batches
- * hj_OuterReadPos current read position of outer batch
- * hj_OuterReadBlk current read block of outer batch
- * hj_OuterTupleSlot tuple slot for outer tuples
- * hj_HashTupleSlot tuple slot for hashed tuples
- *
- *
- *
- * JoinState information
- *
- * CommonState information
- *
- * OuterTupleSlot pointer to slot containing current "outer" tuple
- * ResultTupleSlot pointer to slot in tuple table for projected tuple
- * ExprContext node's current expression context
- * ProjInfo info this node uses to form tuple projections
- * NumScanAttributes size of ScanAttributes array
- * ScanAttributes attribute numbers of interest in this tuple
+ * HashJoinState information
+ *
+ * hj_HashTable address of the hash table for the hashjoin
+ * hj_HashTableShmId shared memory id of hash table
+ * hj_CurBucket the current hash bucket that we are searching
+ * for matches of the current outer tuple
+ * hj_CurTuple the current matching inner tuple in the
+ * current hash bucket
+ * hj_CurOTuple the current matching inner tuple in the
+ * current hash overflow chain
+ * hj_InnerHashKey the inner hash key in the hashjoin condition
+ * hj_OuterBatches file descriptors for outer batches
+ * hj_InnerBatches file descriptors for inner batches
+ * hj_OuterReadPos current read position of outer batch
+ * hj_OuterReadBlk current read block of outer batch
+ * hj_OuterTupleSlot tuple slot for outer tuples
+ * hj_HashTupleSlot tuple slot for hashed tuples
+ *
+ *
+ *
+ * JoinState information
+ *
+ * CommonState information
+ *
+ * OuterTupleSlot pointer to slot containing current "outer" tuple
+ * ResultTupleSlot pointer to slot in tuple table for projected tuple
+ * ExprContext node's current expression context
+ * ProjInfo info this node uses to form tuple projections
+ * NumScanAttributes size of ScanAttributes array
+ * ScanAttributes attribute numbers of interest in this tuple
* ----------------
*/
-typedef struct HashJoinState {
- JoinState jstate; /* its first field is NodeTag */
- HashJoinTable hj_HashTable;
- IpcMemoryId hj_HashTableShmId;
- HashBucket hj_CurBucket;
- HeapTuple hj_CurTuple;
- OverflowTuple hj_CurOTuple;
- Var *hj_InnerHashKey;
- File *hj_OuterBatches;
- File *hj_InnerBatches;
- char *hj_OuterReadPos;
- int hj_OuterReadBlk;
- TupleTableSlot *hj_OuterTupleSlot;
- TupleTableSlot *hj_HashTupleSlot;
-} HashJoinState;
+typedef struct HashJoinState
+{
+ JoinState jstate; /* its first field is NodeTag */
+ HashJoinTable hj_HashTable;
+ IpcMemoryId hj_HashTableShmId;
+ HashBucket hj_CurBucket;
+ HeapTuple hj_CurTuple;
+ OverflowTuple hj_CurOTuple;
+ Var *hj_InnerHashKey;
+ File *hj_OuterBatches;
+ File *hj_InnerBatches;
+ char *hj_OuterReadPos;
+ int hj_OuterReadBlk;
+ TupleTableSlot *hj_OuterTupleSlot;
+ TupleTableSlot *hj_HashTupleSlot;
+} HashJoinState;
/* ----------------------------------------------------------------
- * Materialization State Information
+ * Materialization State Information
* ----------------------------------------------------------------
*/
/* ----------------
- * MaterialState information
+ * MaterialState information
*
- * materialize nodes are used to materialize the results
- * of a subplan into a temporary relation.
+ * materialize nodes are used to materialize the results
+ * of a subplan into a temporary relation.
*
- * Flag indicated whether subplan has been materialized
- * TempRelation temporary relation containing result of executing
- * the subplan.
+ * Flag indicated whether subplan has been materialized
+ * TempRelation temporary relation containing result of executing
+ * the subplan.
*
- * CommonScanState information
+ * CommonScanState information
*
- * currentRelation relation descriptor of sorted relation
- * currentScanDesc current scan descriptor for scan
- * ScanTupleSlot pointer to slot in tuple table holding scan tuple
+ * currentRelation relation descriptor of sorted relation
+ * currentScanDesc current scan descriptor for scan
+ * ScanTupleSlot pointer to slot in tuple table holding scan tuple
*
- * CommonState information
+ * CommonState information
*
- * OuterTupleSlot pointer to slot containing current "outer" tuple
- * ResultTupleSlot pointer to slot in tuple table for projected tuple
- * ExprContext node's current expression context
- * ProjInfo info this node uses to form tuple projections
- * NumScanAttributes size of ScanAttributes array
- * ScanAttributes attribute numbers of interest in this tuple
+ * OuterTupleSlot pointer to slot containing current "outer" tuple
+ * ResultTupleSlot pointer to slot in tuple table for projected tuple
+ * ExprContext node's current expression context
+ * ProjInfo info this node uses to form tuple projections
+ * NumScanAttributes size of ScanAttributes array
+ * ScanAttributes attribute numbers of interest in this tuple
* ----------------
*/
-typedef struct MaterialState {
- CommonScanState csstate; /* its first field is NodeTag */
- bool mat_Flag;
- Relation mat_TempRelation;
-} MaterialState;
+typedef struct MaterialState
+{
+ CommonScanState csstate; /* its first field is NodeTag */
+ bool mat_Flag;
+ Relation mat_TempRelation;
+} MaterialState;
/* ---------------------
- * AggregateState information
+ * AggregateState information
*
- * done indicated whether aggregate has been materialized
+ * done indicated whether aggregate has been materialized
* -------------------------
*/
-typedef struct AggState {
- CommonScanState csstate; /* its first field is NodeTag */
- bool agg_done;
-} AggState;
+typedef struct AggState
+{
+ CommonScanState csstate; /* its first field is NodeTag */
+ bool agg_done;
+} AggState;
/* ---------------------
- * GroupState information
+ * GroupState information
*
* -------------------------
*/
-typedef struct GroupState {
- CommonScanState csstate; /* its first field is NodeTag */
- bool grp_useLastTuple; /* last tuple not processed yet */
- bool grp_done;
- TupleTableSlot *grp_lastSlot;
-} GroupState;
+typedef struct GroupState
+{
+ CommonScanState csstate; /* its first field is NodeTag */
+ bool grp_useLastTuple; /* last tuple not processed yet */
+ bool grp_done;
+ TupleTableSlot *grp_lastSlot;
+} GroupState;
/* ----------------
- * SortState information
- *
- *| sort nodes are really just a kind of a scan since
- *| we implement sorts by retrieveing the entire subplan
- *| into a temp relation, sorting the temp relation into
- *| another sorted relation, and then preforming a simple
- *| unqualified sequential scan on the sorted relation..
- *| -cim 10/15/89
- *
- * Flag indicated whether relation has been sorted
- * Keys scan key structures used to keep info on sort keys
- * TempRelation temporary relation containing result of executing
- * the subplan.
- *
- * CommonScanState information
- *
- * currentRelation relation descriptor of sorted relation
- * currentScanDesc current scan descriptor for scan
- * ScanTupleSlot pointer to slot in tuple table holding scan tuple
- *
- * CommonState information
- *
- * OuterTupleSlot pointer to slot containing current "outer" tuple
- * ResultTupleSlot pointer to slot in tuple table for projected tuple
- * ExprContext node's current expression context
- * ProjInfo info this node uses to form tuple projections
- * NumScanAttributes size of ScanAttributes array
- * ScanAttributes attribute numbers of interest in this tuple
+ * SortState information
+ *
+ *| sort nodes are really just a kind of a scan since
+ *| we implement sorts by retrieveing the entire subplan
+ *| into a temp relation, sorting the temp relation into
+ *| another sorted relation, and then preforming a simple
+ *| unqualified sequential scan on the sorted relation..
+ *| -cim 10/15/89
+ *
+ * Flag indicated whether relation has been sorted
+ * Keys scan key structures used to keep info on sort keys
+ * TempRelation temporary relation containing result of executing
+ * the subplan.
+ *
+ * CommonScanState information
+ *
+ * currentRelation relation descriptor of sorted relation
+ * currentScanDesc current scan descriptor for scan
+ * ScanTupleSlot pointer to slot in tuple table holding scan tuple
+ *
+ * CommonState information
+ *
+ * OuterTupleSlot pointer to slot containing current "outer" tuple
+ * ResultTupleSlot pointer to slot in tuple table for projected tuple
+ * ExprContext node's current expression context
+ * ProjInfo info this node uses to form tuple projections
+ * NumScanAttributes size of ScanAttributes array
+ * ScanAttributes attribute numbers of interest in this tuple
* ----------------
*/
-typedef struct SortState {
- CommonScanState csstate; /* its first field is NodeTag */
- bool sort_Flag;
- ScanKey sort_Keys;
- bool cleaned;
-} SortState;
+typedef struct SortState
+{
+ CommonScanState csstate; /* its first field is NodeTag */
+ bool sort_Flag;
+ ScanKey sort_Keys;
+ bool cleaned;
+} SortState;
/* ----------------
- * UniqueState information
- *
- * Unique nodes are used "on top of" sort nodes to discard
- * duplicate tuples returned from the sort phase. Basically
- * all it does is compare the current tuple from the subplan
- * with the previously fetched tuple stored in OuterTuple and
- * if the two are identical, then we just fetch another tuple
- * from the sort and try again.
- *
- * CommonState information
- *
- * OuterTupleSlot pointer to slot containing current "outer" tuple
- * ResultTupleSlot pointer to slot in tuple table for projected tuple
- * ExprContext node's current expression context
- * ProjInfo info this node uses to form tuple projections
- * NumScanAttributes size of ScanAttributes array
- * ScanAttributes attribute numbers of interest in this tuple
+ * UniqueState information
+ *
+ * Unique nodes are used "on top of" sort nodes to discard
+ * duplicate tuples returned from the sort phase. Basically
+ * all it does is compare the current tuple from the subplan
+ * with the previously fetched tuple stored in OuterTuple and
+ * if the two are identical, then we just fetch another tuple
+ * from the sort and try again.
+ *
+ * CommonState information
+ *
+ * OuterTupleSlot pointer to slot containing current "outer" tuple
+ * ResultTupleSlot pointer to slot in tuple table for projected tuple
+ * ExprContext node's current expression context
+ * ProjInfo info this node uses to form tuple projections
+ * NumScanAttributes size of ScanAttributes array
+ * ScanAttributes attribute numbers of interest in this tuple
* ----------------
*/
-typedef CommonState UniqueState;
+typedef CommonState UniqueState;
/* ----------------
- * HashState information
+ * HashState information
*
- * hashBatches file descriptors for the batches
+ * hashBatches file descriptors for the batches
*
- * CommonState information
+ * CommonState information
*
- * OuterTupleSlot pointer to slot containing current "outer" tuple
- * ResultTupleSlot pointer to slot in tuple table for projected tuple
- * ExprContext node's current expression context
- * ProjInfo info this node uses to form tuple projections
- * NumScanAttributes size of ScanAttributes array
- * ScanAttributes attribute numbers of interest in this tuple
+ * OuterTupleSlot pointer to slot containing current "outer" tuple
+ * ResultTupleSlot pointer to slot in tuple table for projected tuple
+ * ExprContext node's current expression context
+ * ProjInfo info this node uses to form tuple projections
+ * NumScanAttributes size of ScanAttributes array
+ * ScanAttributes attribute numbers of interest in this tuple
* ----------------
*/
-typedef struct HashState {
- CommonState cstate; /* its first field is NodeTag */
- File *hashBatches;
-} HashState;
+typedef struct HashState
+{
+ CommonState cstate; /* its first field is NodeTag */
+ File *hashBatches;
+} HashState;
/* -----------------------
- * TeeState information
- * leftPlace : next item in the queue unseen by the left parent
- * rightPlace : next item in the queue unseen by the right parent
- * lastPlace : last item in the queue
- * bufferRelname : name of the relation used as the buffer queue
- * bufferRel : the relation used as the buffer queue
- * mcxt : for now, tee's have their own memory context
- * may be cleaned up later if portals are cleaned up
- *
- * initially, a Tee starts with [left/right]Place variables set to -1.
+ * TeeState information
+ * leftPlace : next item in the queue unseen by the left parent
+ * rightPlace : next item in the queue unseen by the right parent
+ * lastPlace : last item in the queue
+ * bufferRelname : name of the relation used as the buffer queue
+ * bufferRel : the relation used as the buffer queue
+ * mcxt : for now, tee's have their own memory context
+ * may be cleaned up later if portals are cleaned up
+ *
+ * initially, a Tee starts with [left/right]Place variables set to -1.
* on cleanup, queue is free'd when both leftPlace and rightPlace = -1
- * -------------------------
+ * -------------------------
*/
-typedef struct TeeState {
- CommonState cstate; /* its first field is NodeTag */
- int tee_leftPlace;
- int tee_rightPlace;
- int tee_lastPlace;
- char *tee_bufferRelname;
- Relation tee_bufferRel;
- MemoryContext tee_mcxt;
- HeapScanDesc tee_leftScanDesc;
- HeapScanDesc tee_rightScanDesc;
-} TeeState;
-
-#endif /* EXECNODES_H */
+typedef struct TeeState
+{
+ CommonState cstate; /* its first field is NodeTag */
+ int tee_leftPlace;
+ int tee_rightPlace;
+ int tee_lastPlace;
+ char *tee_bufferRelname;
+ Relation tee_bufferRel;
+ MemoryContext tee_mcxt;
+ HeapScanDesc tee_leftScanDesc;
+ HeapScanDesc tee_rightScanDesc;
+} TeeState;
+
+#endif /* EXECNODES_H */
diff --git a/src/include/nodes/makefuncs.h b/src/include/nodes/makefuncs.h
index a10182a33ee..04b2c10c442 100644
--- a/src/include/nodes/makefuncs.h
+++ b/src/include/nodes/makefuncs.h
@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* makefuncs.h--
- * prototypes for the creator functions (for primitive nodes)
+ * prototypes for the creator functions (for primitive nodes)
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: makefuncs.h,v 1.3 1997/01/22 01:43:41 momjian Exp $
+ * $Id: makefuncs.h,v 1.4 1997/09/07 04:58:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,32 +16,36 @@
#include <nodes/primnodes.h>
#include <utils/fcache.h>
-extern Oper *makeOper(Oid opno,
- Oid opid,
- Oid opresulttype,
- int opsize,
- FunctionCachePtr op_fcache);
+extern Oper *
+makeOper(Oid opno,
+ Oid opid,
+ Oid opresulttype,
+ int opsize,
+ FunctionCachePtr op_fcache);
-extern Var *makeVar(Index varno,
- AttrNumber varattno,
- Oid vartype,
- Index varnoold,
- AttrNumber varoattno);
+extern Var *
+makeVar(Index varno,
+ AttrNumber varattno,
+ Oid vartype,
+ Index varnoold,
+ AttrNumber varoattno);
-extern Resdom *makeResdom(AttrNumber resno,
- Oid restype,
- int reslen,
- char *resname,
- Index reskey,
- Oid reskeyop,
- int resjunk);
-
-extern Const *makeConst(Oid consttype,
- Size constlen,
- Datum constvalue,
- bool constisnull,
- bool constbyval,
- bool constisset,
- bool constiscast);
+extern Resdom *
+makeResdom(AttrNumber resno,
+ Oid restype,
+ int reslen,
+ char *resname,
+ Index reskey,
+ Oid reskeyop,
+ int resjunk);
-#endif /* MAKEFUNC_H */
+extern Const *
+makeConst(Oid consttype,
+ Size constlen,
+ Datum constvalue,
+ bool constisnull,
+ bool constbyval,
+ bool constisset,
+ bool constiscast);
+
+#endif /* MAKEFUNC_H */
diff --git a/src/include/nodes/memnodes.h b/src/include/nodes/memnodes.h
index 594bff6db42..1d5bced1f3c 100644
--- a/src/include/nodes/memnodes.h
+++ b/src/include/nodes/memnodes.h
@@ -1,21 +1,21 @@
/*-------------------------------------------------------------------------
*
* memnodes.h--
- * POSTGRES memory context node definitions.
+ * POSTGRES memory context node definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: memnodes.h,v 1.4 1996/11/04 07:59:34 scrappy Exp $
+ * $Id: memnodes.h,v 1.5 1997/09/07 04:58:35 momjian Exp $
*
* XXX the typedefs in this file are different from the other ???nodes.h;
- * they are pointers to structures instead of the structures themselves.
- * If you're wondering, this is plain laziness. I don't want to touch
- * the memory context code which should be revamped altogether some day.
- * - ay 10/94
+ * they are pointers to structures instead of the structures themselves.
+ * If you're wondering, this is plain laziness. I don't want to touch
+ * the memory context code which should be revamped altogether some day.
+ * - ay 10/94
*-------------------------------------------------------------------------
*/
-#ifndef MEMNODES_H
+#ifndef MEMNODES_H
#define MEMNODES_H
#include <lib/fstack.h>
@@ -24,75 +24,78 @@
/*
* MemoryContext --
- * A logical context in which memory allocations occur.
+ * A logical context in which memory allocations occur.
*
* The types of memory contexts can be thought of as members of the
* following inheritance hierarchy with properties summarized below.
*
- * Node
- * |
- * MemoryContext___
- * / \
- * GlobalMemory PortalMemoryContext
- * / \
- * PortalVariableMemory PortalHeapMemory
+ * Node
+ * |
+ * MemoryContext___
+ * / \
+ * GlobalMemory PortalMemoryContext
+ * / \
+ * PortalVariableMemory PortalHeapMemory
*
- * Flushed at Flushed at Checkpoints
- * Transaction Portal
- * Commit Close
+ * Flushed at Flushed at Checkpoints
+ * Transaction Portal
+ * Commit Close
*
- * GlobalMemory n n n
- * PortalVariableMemory n y n
- * PortalHeapMemory y y y
+ * GlobalMemory n n n
+ * PortalVariableMemory n y n
+ * PortalHeapMemory y y y
*/
-typedef struct MemoryContextMethodsData {
- Pointer (*alloc)();
- void (*free_p)(); /* need to use free as a #define,
- so can't use free */
- Pointer (*realloc)();
- char* (*getName)();
- void (*dump)();
-} *MemoryContextMethods;
+typedef struct MemoryContextMethodsData
+{
+ Pointer(*alloc) ();
+ void (*free_p) (); /* need to use free as a #define,
+ * so can't use free */
+ Pointer(*realloc) ();
+ char *(*getName) ();
+ void (*dump) ();
+} *MemoryContextMethods;
-typedef struct MemoryContext {
- NodeTag type;
- MemoryContextMethods method;
-} *MemoryContext;
+typedef struct MemoryContext
+{
+ NodeTag type;
+ MemoryContextMethods method;
+} *MemoryContext;
/* think about doing this right some time but we'll have explicit fields
for now -ay 10/94 */
-typedef struct GlobalMemory {
- NodeTag type;
- MemoryContextMethods method;
- AllocSetData setData;
- char *name;
- OrderedElemData elemData;
-} *GlobalMemory;
+typedef struct GlobalMemory
+{
+ NodeTag type;
+ MemoryContextMethods method;
+ AllocSetData setData;
+ char *name;
+ OrderedElemData elemData;
+} *GlobalMemory;
typedef MemoryContext *PortalMemoryContext;
-typedef struct PortalVariableMemory {
- NodeTag type;
- MemoryContextMethods method;
- AllocSetData setData;
-} *PortalVariableMemory;
+typedef struct PortalVariableMemory
+{
+ NodeTag type;
+ MemoryContextMethods method;
+ AllocSetData setData;
+} *PortalVariableMemory;
-typedef struct PortalHeapMemory {
- NodeTag type;
- MemoryContextMethods method;
- Pointer block;
- FixedStackData stackData;
-} *PortalHeapMemory;
+typedef struct PortalHeapMemory
+{
+ NodeTag type;
+ MemoryContextMethods method;
+ Pointer block;
+ FixedStackData stackData;
+} *PortalHeapMemory;
/*
* MemoryContextIsValid --
- * True iff memory context is valid.
+ * True iff memory context is valid.
*/
#define MemoryContextIsValid(context) \
- (IsA(context,MemoryContext) || IsA(context,GlobalMemory) || \
- IsA(context,PortalVariableMemory) || IsA(context,PortalHeapMemory))
-
-#endif /* MEMNODES_H */
-
+ (IsA(context,MemoryContext) || IsA(context,GlobalMemory) || \
+ IsA(context,PortalVariableMemory) || IsA(context,PortalHeapMemory))
+#endif /* MEMNODES_H */
diff --git a/src/include/nodes/nodeFuncs.h b/src/include/nodes/nodeFuncs.h
index 12a0ca97813..3edc598a833 100644
--- a/src/include/nodes/nodeFuncs.h
+++ b/src/include/nodes/nodeFuncs.h
@@ -1,22 +1,22 @@
/*-------------------------------------------------------------------------
*
* nodeFuncs.h--
- *
+ *
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: nodeFuncs.h,v 1.2 1997/08/19 21:38:43 momjian Exp $
+ * $Id: nodeFuncs.h,v 1.3 1997/09/07 04:58:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef NODEFUNCS_H
#define NODEFUNCS_H
-extern bool single_node(Node *node);
-extern bool var_is_outer(Var *var);
-extern bool var_is_rel(Var *var);
-extern Oper *replace_opid(Oper *oper);
-extern bool non_null(Expr *c);
+extern bool single_node(Node * node);
+extern bool var_is_outer(Var * var);
+extern bool var_is_rel(Var * var);
+extern Oper *replace_opid(Oper * oper);
+extern bool non_null(Expr * c);
-#endif /* NODEFUNCS_H */
+#endif /* NODEFUNCS_H */
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h
index 66c1b1812ce..944ed7453f2 100644
--- a/src/include/nodes/nodes.h
+++ b/src/include/nodes/nodes.h
@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
* nodes.h--
- * Definitions for tagged nodes.
+ * Definitions for tagged nodes.
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: nodes.h,v 1.11 1997/09/01 06:04:57 thomas Exp $
+ * $Id: nodes.h,v 1.12 1997/09/07 04:58:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef NODES_H
-#define NODES_H
+#define NODES_H
/*
* The first field of every node is NodeTag. Each node created (with makeNode)
@@ -20,195 +20,196 @@
* Note that the number of the node tags are not contiguous. We left holes
* here so that we can add more tags without changing the existing enum's.
*/
-typedef enum NodeTag {
- T_Invalid = 0,
+typedef enum NodeTag
+{
+ T_Invalid = 0,
- /*---------------------
- * TAGS FOR PLAN NODES (plannodes.h)
- *---------------------
- */
- T_Plan = 10,
- T_Existential,
- T_Result,
- T_Append,
- T_Scan,
- T_SeqScan,
- T_IndexScan,
- T_Join,
- T_NestLoop,
- T_MergeJoin,
- T_HashJoin,
- T_Temp,
- T_Material,
- T_Sort,
- T_Agg,
- T_Unique,
- T_Hash,
- T_Choose,
- T_Tee,
- T_Group,
+ /*---------------------
+ * TAGS FOR PLAN NODES (plannodes.h)
+ *---------------------
+ */
+ T_Plan = 10,
+ T_Existential,
+ T_Result,
+ T_Append,
+ T_Scan,
+ T_SeqScan,
+ T_IndexScan,
+ T_Join,
+ T_NestLoop,
+ T_MergeJoin,
+ T_HashJoin,
+ T_Temp,
+ T_Material,
+ T_Sort,
+ T_Agg,
+ T_Unique,
+ T_Hash,
+ T_Choose,
+ T_Tee,
+ T_Group,
- /*---------------------
- * TAGS FOR PRIMITIVE NODES (primnodes.h)
- *---------------------
- */
- T_Resdom = 100,
- T_Fjoin,
- T_Expr,
- T_Var,
- T_Oper,
- T_Const,
- T_Param,
- T_Aggreg,
- T_Func,
- T_Array,
- T_ArrayRef,
+ /*---------------------
+ * TAGS FOR PRIMITIVE NODES (primnodes.h)
+ *---------------------
+ */
+ T_Resdom = 100,
+ T_Fjoin,
+ T_Expr,
+ T_Var,
+ T_Oper,
+ T_Const,
+ T_Param,
+ T_Aggreg,
+ T_Func,
+ T_Array,
+ T_ArrayRef,
- /*---------------------
- * TAGS FOR INNER PLAN NODES (relation.h)
- *---------------------
- */
- T_Rel = 200,
- T_Path,
- T_IndexPath,
- T_JoinPath,
- T_MergePath,
- T_HashPath,
- T_OrderKey,
- T_JoinKey,
- T_MergeOrder,
- T_CInfo,
- T_JoinMethod,
- T_HInfo,
- T_MInfo,
- T_JInfo,
- T_Iter,
- T_Stream,
+ /*---------------------
+ * TAGS FOR INNER PLAN NODES (relation.h)
+ *---------------------
+ */
+ T_Rel = 200,
+ T_Path,
+ T_IndexPath,
+ T_JoinPath,
+ T_MergePath,
+ T_HashPath,
+ T_OrderKey,
+ T_JoinKey,
+ T_MergeOrder,
+ T_CInfo,
+ T_JoinMethod,
+ T_HInfo,
+ T_MInfo,
+ T_JInfo,
+ T_Iter,
+ T_Stream,
- /*---------------------
- * TAGS FOR EXECUTOR NODES (execnodes.h)
- *---------------------
- */
- T_IndexInfo = 300,
- T_RelationInfo,
- T_TupleCount,
- T_TupleTableSlot,
- T_ExprContext,
- T_ProjectionInfo,
- T_JunkFilter,
- T_EState,
- T_BaseNode,
- T_CommonState,
- T_ResultState,
- T_AppendState,
- T_CommonScanState,
- T_ScanState,
- T_IndexScanState,
- T_JoinState,
- T_NestLoopState,
- T_MergeJoinState,
- T_HashJoinState,
- T_MaterialState,
- T_AggState,
- T_GroupState,
- T_SortState,
- T_UniqueState,
- T_HashState,
- T_TeeState,
+ /*---------------------
+ * TAGS FOR EXECUTOR NODES (execnodes.h)
+ *---------------------
+ */
+ T_IndexInfo = 300,
+ T_RelationInfo,
+ T_TupleCount,
+ T_TupleTableSlot,
+ T_ExprContext,
+ T_ProjectionInfo,
+ T_JunkFilter,
+ T_EState,
+ T_BaseNode,
+ T_CommonState,
+ T_ResultState,
+ T_AppendState,
+ T_CommonScanState,
+ T_ScanState,
+ T_IndexScanState,
+ T_JoinState,
+ T_NestLoopState,
+ T_MergeJoinState,
+ T_HashJoinState,
+ T_MaterialState,
+ T_AggState,
+ T_GroupState,
+ T_SortState,
+ T_UniqueState,
+ T_HashState,
+ T_TeeState,
- /*---------------------
- * TAGS FOR MEMORY NODES (memnodes.h)
- *---------------------
- */
- T_MemoryContext = 400,
- T_GlobalMemory,
- T_PortalMemoryContext,
- T_PortalVariableMemory,
- T_PortalHeapMemory,
+ /*---------------------
+ * TAGS FOR MEMORY NODES (memnodes.h)
+ *---------------------
+ */
+ T_MemoryContext = 400,
+ T_GlobalMemory,
+ T_PortalMemoryContext,
+ T_PortalVariableMemory,
+ T_PortalHeapMemory,
- /*---------------------
- * TAGS FOR VALUE NODES (pg_list.h)
- *---------------------
- */
- T_Value = 500,
- T_List,
- T_Integer,
- T_Float,
- T_String,
- T_Null,
-
- /*---------------------
- * TAGS FOR PARSE TREE NODES (parsenode.h)
- *---------------------
- */
- T_Query = 600,
- T_AppendStmt,
- T_DeleteStmt,
- T_ReplaceStmt,
- T_CursorStmt,
- T_RetrieveStmt,
- T_AddAttrStmt,
- T_AggregateStmt,
- T_ChangeACLStmt,
- T_ClosePortalStmt,
- T_ClusterStmt,
- T_CopyStmt,
- T_CreateStmt,
- T_VersionStmt,
- T_DefineStmt,
- T_DestroyStmt,
- T_ExtendStmt,
- T_FetchStmt,
- T_IndexStmt,
- T_MoveStmt,
- T_ProcedureStmt,
- T_PurgeStmt,
- T_RecipeStmt,
- T_RemoveAggrStmt,
- T_RemoveFuncStmt,
- T_RemoveOperStmt,
- T_RemoveStmt,
- T_RenameStmt,
- T_RuleStmt,
- T_NotifyStmt,
- T_ListenStmt,
- T_TransactionStmt,
- T_ViewStmt,
- T_LoadStmt,
- T_CreatedbStmt,
- T_DestroydbStmt,
- T_VacuumStmt,
- T_ExplainStmt,
- T_CreateSeqStmt,
- T_VariableSetStmt,
- T_VariableShowStmt,
- T_VariableResetStmt,
- T_CreateTrigStmt,
- T_DropTrigStmt,
+ /*---------------------
+ * TAGS FOR VALUE NODES (pg_list.h)
+ *---------------------
+ */
+ T_Value = 500,
+ T_List,
+ T_Integer,
+ T_Float,
+ T_String,
+ T_Null,
- T_A_Expr = 700,
- T_Attr,
- T_A_Const,
- T_ParamNo,
- T_Ident,
- T_FuncCall,
- T_A_Indices,
- T_ResTarget,
- T_ParamString,
- T_TimeRange,
- T_RelExpr,
- T_SortGroupBy,
- T_RangeVar,
- T_TypeName,
- T_IndexElem,
- T_ColumnDef,
- T_DefElem,
- T_TargetEntry,
- T_RangeTblEntry,
- T_SortClause,
- T_GroupClause,
- T_SubSelect
-} NodeTag;
+ /*---------------------
+ * TAGS FOR PARSE TREE NODES (parsenode.h)
+ *---------------------
+ */
+ T_Query = 600,
+ T_AppendStmt,
+ T_DeleteStmt,
+ T_ReplaceStmt,
+ T_CursorStmt,
+ T_RetrieveStmt,
+ T_AddAttrStmt,
+ T_AggregateStmt,
+ T_ChangeACLStmt,
+ T_ClosePortalStmt,
+ T_ClusterStmt,
+ T_CopyStmt,
+ T_CreateStmt,
+ T_VersionStmt,
+ T_DefineStmt,
+ T_DestroyStmt,
+ T_ExtendStmt,
+ T_FetchStmt,
+ T_IndexStmt,
+ T_MoveStmt,
+ T_ProcedureStmt,
+ T_PurgeStmt,
+ T_RecipeStmt,
+ T_RemoveAggrStmt,
+ T_RemoveFuncStmt,
+ T_RemoveOperStmt,
+ T_RemoveStmt,
+ T_RenameStmt,
+ T_RuleStmt,
+ T_NotifyStmt,
+ T_ListenStmt,
+ T_TransactionStmt,
+ T_ViewStmt,
+ T_LoadStmt,
+ T_CreatedbStmt,
+ T_DestroydbStmt,
+ T_VacuumStmt,
+ T_ExplainStmt,
+ T_CreateSeqStmt,
+ T_VariableSetStmt,
+ T_VariableShowStmt,
+ T_VariableResetStmt,
+ T_CreateTrigStmt,
+ T_DropTrigStmt,
+
+ T_A_Expr = 700,
+ T_Attr,
+ T_A_Const,
+ T_ParamNo,
+ T_Ident,
+ T_FuncCall,
+ T_A_Indices,
+ T_ResTarget,
+ T_ParamString,
+ T_TimeRange,
+ T_RelExpr,
+ T_SortGroupBy,
+ T_RangeVar,
+ T_TypeName,
+ T_IndexElem,
+ T_ColumnDef,
+ T_DefElem,
+ T_TargetEntry,
+ T_RangeTblEntry,
+ T_SortClause,
+ T_GroupClause,
+ T_SubSelect
+} NodeTag;
/*
* The first field of a node of any type is gauranteed to be the NodeTag.
@@ -216,90 +217,93 @@ typedef enum NodeTag {
* a variable to be of Node * (instead of void *) can also facilitate
* debugging.
*/
-typedef struct Node {
- NodeTag type;
-} Node;
+typedef struct Node
+{
+ NodeTag type;
+} Node;
-#define nodeTag(_node_) ((Node*)_node_)->type
+#define nodeTag(_node_) ((Node*)_node_)->type
-#define makeNode(_node_) (_node_*)newNode(sizeof(_node_),T_##_node_)
-#define NodeSetTag(n, t) ((Node *)n)->type = t
+#define makeNode(_node_) (_node_*)newNode(sizeof(_node_),T_##_node_)
+#define NodeSetTag(n, t) ((Node *)n)->type = t
-#define IsA(_node_,_tag_) (nodeTag(_node_) == T_##_tag_)
+#define IsA(_node_,_tag_) (nodeTag(_node_) == T_##_tag_)
/* ----------------------------------------------------------------
- * IsA functions (no inheritence any more)
+ * IsA functions (no inheritence any more)
* ----------------------------------------------------------------
*/
#define IsA_JoinPath(jp) \
- (nodeTag(jp)==T_JoinPath || nodeTag(jp)==T_MergePath || \
- nodeTag(jp)==T_HashPath)
+ (nodeTag(jp)==T_JoinPath || nodeTag(jp)==T_MergePath || \
+ nodeTag(jp)==T_HashPath)
#define IsA_Join(j) \
- (nodeTag(j)==T_Join || nodeTag(j)==T_NestLoop || \
- nodeTag(j)==T_MergeJoin || nodeTag(j)==T_HashJoin)
+ (nodeTag(j)==T_Join || nodeTag(j)==T_NestLoop || \
+ nodeTag(j)==T_MergeJoin || nodeTag(j)==T_HashJoin)
#define IsA_Temp(t) \
- (nodeTag(t)==T_Temp || nodeTag(t)==T_Material || nodeTag(t)==T_Sort || \
- nodeTag(t)==T_Unique)
+ (nodeTag(t)==T_Temp || nodeTag(t)==T_Material || nodeTag(t)==T_Sort || \
+ nodeTag(t)==T_Unique)
/* ----------------------------------------------------------------
- * extern declarations follow
+ * extern declarations follow
* ----------------------------------------------------------------
*/
/*
* nodes/nodes.c
*/
-extern Node *newNode(Size size, NodeTag tag);
+extern Node *newNode(Size size, NodeTag tag);
/*
* nodes/{outfuncs.c,print.c}
*/
-#define nodeDisplay pprint
+#define nodeDisplay pprint
-extern char *nodeToString(void *obj);
-extern void print(void *obj);
+extern char *nodeToString(void *obj);
+extern void print(void *obj);
/*
* nodes/{readfuncs.c,read.c}
*/
-extern void *stringToNode(char *str);
+extern void *stringToNode(char *str);
/*
* nodes/copyfuncs.c
*/
-extern void *copyObject(void *obj);
+extern void *copyObject(void *obj);
/*
* nodes/equalfuncs.c
*/
-extern bool equal(void *a, void *b);
+extern bool equal(void *a, void *b);
/* ----------------
- * I don't know why this is here. Most likely a hack..
- * -cim 6/3/90
+ * I don't know why this is here. Most likely a hack..
+ * -cim 6/3/90
* ----------------
*/
-typedef float Cost;
+typedef float Cost;
/*
* CmdType -
- * enums for type of operation to aid debugging
+ * enums for type of operation to aid debugging
*
* ??? could have put this in parsenodes.h but many files not in the
- * optimizer also need this...
+ * optimizer also need this...
*/
-typedef enum CmdType {
- CMD_UNKNOWN,
- CMD_SELECT, /* select stmt (formerly retrieve) */
- CMD_UPDATE, /* update stmt (formerly replace) */
- CMD_INSERT, /* insert stmt (formerly append) */
- CMD_DELETE,
- CMD_NOTIFY,
- CMD_UTILITY /* cmds like create, destroy, copy, vacuum, etc. */
-} CmdType;
-
+typedef enum CmdType
+{
+ CMD_UNKNOWN,
+ CMD_SELECT, /* select stmt (formerly retrieve) */
+ CMD_UPDATE, /* update stmt (formerly replace) */
+ CMD_INSERT, /* insert stmt (formerly append) */
+ CMD_DELETE,
+ CMD_NOTIFY,
+ CMD_UTILITY /* cmds like create, destroy, copy,
+ * vacuum, etc. */
+} CmdType;
+
-#endif /* NODES_H */
+#endif /* NODES_H */
diff --git a/src/include/nodes/params.h b/src/include/nodes/params.h
index 93e79268123..78f0d1cd64b 100644
--- a/src/include/nodes/params.h
+++ b/src/include/nodes/params.h
@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* params.h--
- * Declarations/definitions of stuff needed to handle parameterized plans.
+ * Declarations/definitions of stuff needed to handle parameterized plans.
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: params.h,v 1.3 1996/11/04 08:52:57 scrappy Exp $
+ * $Id: params.h,v 1.4 1997/09/07 04:58:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,71 +19,72 @@
*
* The following are the possible values for the 'paramkind'
* field of a Param node.
- *
+ *
* PARAM_NAMED: The parameter has a name, i.e. something
- * like `$.salary' or `$.foobar'.
- * In this case field `paramname' must be a valid Name.
- * and field `paramid' must be == 0.
+ * like `$.salary' or `$.foobar'.
+ * In this case field `paramname' must be a valid Name.
+ * and field `paramid' must be == 0.
+ *
+ * PARAM_NUM: The parameter has only a numeric identifier,
+ * i.e. something like `$1', `$2' etc.
+ * The number is contained in the `parmid' field.
*
- * PARAM_NUM: The parameter has only a numeric identifier,
- * i.e. something like `$1', `$2' etc.
- * The number is contained in the `parmid' field.
+ * PARAM_NEW: Used in PRS2 rule, similar to PARAM_NAMED.
+ * The `paramname' & `paramid' refer to the "NEW" tuple
+ * `paramname' is the attribute name and `paramid' its
+ * attribute number.
*
- * PARAM_NEW: Used in PRS2 rule, similar to PARAM_NAMED.
- * The `paramname' & `paramid' refer to the "NEW" tuple
- * `paramname' is the attribute name and `paramid' its
- * attribute number.
- *
- * PARAM_OLD: Same as PARAM_NEW, but in this case we refer to
- * the "OLD" tuple.
+ * PARAM_OLD: Same as PARAM_NEW, but in this case we refer to
+ * the "OLD" tuple.
*/
-#define PARAM_NAMED 11
-#define PARAM_NUM 12
-#define PARAM_NEW 13
-#define PARAM_OLD 14
-#define PARAM_INVALID 100
+#define PARAM_NAMED 11
+#define PARAM_NUM 12
+#define PARAM_NEW 13
+#define PARAM_OLD 14
+#define PARAM_INVALID 100
/* ----------------------------------------------------------------
- * ParamListInfo
+ * ParamListInfo
*
- * Information needed in order for the executor to handle
- * parameterized plans (you know, $.salary, $.name etc. stuff...).
+ * Information needed in order for the executor to handle
+ * parameterized plans (you know, $.salary, $.name etc. stuff...).
*
- * ParamListInfoData contains information needed when substituting a
- * Param node with a Const node.
+ * ParamListInfoData contains information needed when substituting a
+ * Param node with a Const node.
*
- * kind : the kind of parameter.
- * name : the parameter name (valid if kind == PARAM_NAMED,
- * PARAM_NEW or PARAM_OLD)
- * id : the parameter id (valid if kind == PARAM_NUM)
- * or the attrno (if kind == PARAM_NEW or PARAM_OLD)
- * type : PG_TYPE OID of the value
- * length : length in bytes of the value
- * isnull : true if & only if the value is null (if true then
- * the fields 'length' and 'value' are undefined).
- * value : the value that has to be substituted in the place
- * of the parameter.
+ * kind : the kind of parameter.
+ * name : the parameter name (valid if kind == PARAM_NAMED,
+ * PARAM_NEW or PARAM_OLD)
+ * id : the parameter id (valid if kind == PARAM_NUM)
+ * or the attrno (if kind == PARAM_NEW or PARAM_OLD)
+ * type : PG_TYPE OID of the value
+ * length : length in bytes of the value
+ * isnull : true if & only if the value is null (if true then
+ * the fields 'length' and 'value' are undefined).
+ * value : the value that has to be substituted in the place
+ * of the parameter.
*
- * ParamListInfo is to be used as an array of ParamListInfoData
- * records. An 'InvalidName' in the name field of such a record
- * indicates that this is the last record in the array.
+ * ParamListInfo is to be used as an array of ParamListInfoData
+ * records. An 'InvalidName' in the name field of such a record
+ * indicates that this is the last record in the array.
*
* ----------------------------------------------------------------
*/
-typedef struct ParamListInfoData {
- int kind;
- char *name;
- AttrNumber id;
- Oid type;
- Size length;
- bool isnull;
- bool byval;
- Datum value;
-} ParamListInfoData;
+typedef struct ParamListInfoData
+{
+ int kind;
+ char *name;
+ AttrNumber id;
+ Oid type;
+ Size length;
+ bool isnull;
+ bool byval;
+ Datum value;
+} ParamListInfoData;
typedef ParamListInfoData *ParamListInfo;
-#endif /* PARAMS_H */
+#endif /* PARAMS_H */
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 8492dcde1d8..c24d27918c2 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -1,844 +1,914 @@
/*-------------------------------------------------------------------------
*
* parsenodes.h--
- * definitions for parse tree nodes
+ * definitions for parse tree nodes
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parsenodes.h,v 1.23 1997/09/01 08:11:57 vadim Exp $
+ * $Id: parsenodes.h,v 1.24 1997/09/07 04:58:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
-#ifndef PARSENODES_H
-#define PARSENODES_H
+#ifndef PARSENODES_H
+#define PARSENODES_H
#include <utils/tqual.h>
#include <nodes/primnodes.h>
/*****************************************************************************
- * Query Tree
+ * Query Tree
*****************************************************************************/
/*
* Query -
- * all statments are turned into a Query tree (via transformStmt)
- * for further processing by the optimizer
- * utility statements (i.e. non-optimizable statements)
- * have the *utilityStmt field set.
+ * all statments are turned into a Query tree (via transformStmt)
+ * for further processing by the optimizer
+ * utility statements (i.e. non-optimizable statements)
+ * have the *utilityStmt field set.
*
* we need the isPortal flag because portal names can be null too; can
* get rid of it if we support CURSOR as a commandType.
*
*/
-typedef struct Query {
- NodeTag type;
-
- CmdType commandType; /* select|insert|update|delete|utility */
-
- Node *utilityStmt; /* non-null if this is a non-optimizable
- statement */
-
- int resultRelation; /* target relation (index to rtable) */
- char *into; /* portal (cursor) name */
- bool isPortal; /* is this a retrieve into portal? */
- bool isBinary; /* binary portal? */
-
- char *uniqueFlag; /* NULL, '*', or Unique attribute name */
- List *sortClause; /* a list of SortClause's */
-
- List *rtable; /* list of range table entries */
- List *targetList; /* target list (of TargetEntry) */
- Node *qual; /* qualifications */
-
- List *groupClause; /* list of columns to specified in GROUP BY */
- Node *havingQual; /* qualification of each group */
-
- int qry_numAgg; /* number of aggregates in the target list */
- Aggreg **qry_aggs; /* the aggregates */
-
- /* internal to planner */
- List *base_relation_list_; /* base relation list */
- List *join_relation_list_; /* list of relations generated by joins */
- bool query_is_archival_; /* archival query flag */
-} Query;
+typedef struct Query
+{
+ NodeTag type;
+
+ CmdType commandType;/* select|insert|update|delete|utility */
+
+ Node *utilityStmt;/* non-null if this is a non-optimizable
+ * statement */
+
+ int resultRelation; /* target relation (index to
+ * rtable) */
+ char *into; /* portal (cursor) name */
+ bool isPortal; /* is this a retrieve into portal? */
+ bool isBinary; /* binary portal? */
+
+ char *uniqueFlag; /* NULL, '*', or Unique attribute name */
+ List *sortClause; /* a list of SortClause's */
+
+ List *rtable; /* list of range table entries */
+ List *targetList; /* target list (of TargetEntry) */
+ Node *qual; /* qualifications */
+
+ List *groupClause;/* list of columns to specified in GROUP
+ * BY */
+ Node *havingQual; /* qualification of each group */
+
+ int qry_numAgg; /* number of aggregates in the target list */
+ Aggreg **qry_aggs; /* the aggregates */
+
+ /* internal to planner */
+ List *base_relation_list_; /* base relation list */
+ List *join_relation_list_; /* list of relations
+ * generated by joins */
+ bool query_is_archival_; /* archival query flag */
+} Query;
/*****************************************************************************
- * Other Statements (no optimizations required)
+ * Other Statements (no optimizations required)
*
- * Some of them require a little bit of transformation (which is also
- * done by transformStmt). The whole structure is then passed on to
- * ProcessUtility (by-passing the optimization step) as the utilityStmt
- * field in Query.
+ * Some of them require a little bit of transformation (which is also
+ * done by transformStmt). The whole structure is then passed on to
+ * ProcessUtility (by-passing the optimization step) as the utilityStmt
+ * field in Query.
*****************************************************************************/
/* ----------------------
- * Add Column Statement
+ * Add Column Statement
* ----------------------
*/
-typedef struct AddAttrStmt {
- NodeTag type;
- char *relname; /* the relation to add attr */
- bool inh; /* add recursively to children? */
- struct ColumnDef *colDef; /* the attribute definition */
-} AddAttrStmt;
+typedef struct AddAttrStmt
+{
+ NodeTag type;
+ char *relname; /* the relation to add attr */
+ bool inh; /* add recursively to children? */
+ struct ColumnDef *colDef; /* the attribute definition */
+} AddAttrStmt;
/* ----------------------
- * Change ACL Statement
+ * Change ACL Statement
* ----------------------
*/
-typedef struct ChangeACLStmt {
- NodeTag type;
- struct AclItem *aclitem;
- unsigned modechg;
- List *relNames;
-} ChangeACLStmt;
+typedef struct ChangeACLStmt
+{
+ NodeTag type;
+ struct AclItem *aclitem;
+ unsigned modechg;
+ List *relNames;
+} ChangeACLStmt;
/* ----------------------
- * Close Portal Statement
+ * Close Portal Statement
* ----------------------
*/
-typedef struct ClosePortalStmt {
- NodeTag type;
- char *portalname; /* name of the portal (cursor) */
-} ClosePortalStmt;
+typedef struct ClosePortalStmt
+{
+ NodeTag type;
+ char *portalname; /* name of the portal (cursor) */
+} ClosePortalStmt;
/* ----------------------
- * Copy Statement
+ * Copy Statement
* ----------------------
*/
-typedef struct CopyStmt {
- NodeTag type;
- bool binary; /* is a binary copy? */
- char *relname; /* the relation to copy */
- bool oids; /* copy oid's? */
- int direction; /* TO or FROM */
- char *filename; /* if NULL, use stdin/stdout */
- char *delimiter; /* delimiter character, \t by default*/
-} CopyStmt;
+typedef struct CopyStmt
+{
+ NodeTag type;
+ bool binary; /* is a binary copy? */
+ char *relname; /* the relation to copy */
+ bool oids; /* copy oid's? */
+ int direction; /* TO or FROM */
+ char *filename; /* if NULL, use stdin/stdout */
+ char *delimiter; /* delimiter character, \t by default */
+} CopyStmt;
/* ----------------------
- * Create Table Statement
+ * Create Table Statement
* ----------------------
*/
-typedef enum ArchType {
- ARCH_NONE, ARCH_LIGHT, ARCH_HEAVY /* archive mode */
-} ArchType;
+typedef enum ArchType
+{
+ ARCH_NONE, ARCH_LIGHT, ARCH_HEAVY /* archive mode */
+} ArchType;
-typedef struct CreateStmt {
- NodeTag type;
- char *relname; /* the relation to create */
- List *tableElts; /* column definitions
- list of ColumnDef */
- List *inhRelnames; /* relations to inherit from
- list of Value (string) */
- ArchType archiveType; /* archive mode (ARCH_NONE if none */
- int location; /* smgrid (-1 if none) */
- int archiveLoc; /* smgrid (-1 if none) */
- List *constraints; /* list of constraints (ConstaintDef) */
-} CreateStmt;
+typedef struct CreateStmt
+{
+ NodeTag type;
+ char *relname; /* the relation to create */
+ List *tableElts; /* column definitions list of ColumnDef */
+ List *inhRelnames;/* relations to inherit from list of Value
+ * (string) */
+ ArchType archiveType;/* archive mode (ARCH_NONE if none */
+ int location; /* smgrid (-1 if none) */
+ int archiveLoc; /* smgrid (-1 if none) */
+ List *constraints;/* list of constraints (ConstaintDef) */
+} CreateStmt;
-typedef enum ConstrType {
- CONSTR_NONE, CONSTR_CHECK /* type of constaints */
-} ConstrType;
+typedef enum ConstrType
+{
+ CONSTR_NONE, CONSTR_CHECK /* type of constaints */
+} ConstrType;
-typedef struct ConstraintDef {
- ConstrType type;
- char *name; /* name */
- void *def; /* definition */
-} ConstraintDef;
+typedef struct ConstraintDef
+{
+ ConstrType type;
+ char *name; /* name */
+ void *def; /* definition */
+} ConstraintDef;
/* ----------------------
- * Create/Drop TRIGGER Statements
+ * Create/Drop TRIGGER Statements
* ----------------------
*/
-typedef struct CreateTrigStmt {
- NodeTag type;
- char *trigname; /* TRIGGER' name */
- char *relname; /* triggered relation */
- char *funcname; /* function to call (or NULL) */
- List *args; /* list of (T_String) Values or NULL */
- bool before; /* BEFORE/AFTER */
- bool row; /* ROW/STATEMENT */
- char actions[4]; /* Insert, Update, Delete */
- char *lang; /* NULL (which means Clanguage) */
- char *text; /* AS 'text' */
- List *attr; /* UPDATE OF a, b,... (NI) or NULL */
- char *when; /* WHEN 'a > 10 ...' (NI) or NULL */
-} CreateTrigStmt;
+typedef struct CreateTrigStmt
+{
+ NodeTag type;
+ char *trigname; /* TRIGGER' name */
+ char *relname; /* triggered relation */
+ char *funcname; /* function to call (or NULL) */
+ List *args; /* list of (T_String) Values or NULL */
+ bool before; /* BEFORE/AFTER */
+ bool row; /* ROW/STATEMENT */
+ char actions[4]; /* Insert, Update, Delete */
+ char *lang; /* NULL (which means Clanguage) */
+ char *text; /* AS 'text' */
+ List *attr; /* UPDATE OF a, b,... (NI) or NULL */
+ char *when; /* WHEN 'a > 10 ...' (NI) or NULL */
+} CreateTrigStmt;
-typedef struct DropTrigStmt {
- NodeTag type;
- char *trigname; /* TRIGGER' name */
- char *relname; /* triggered relation */
-} DropTrigStmt;
+typedef struct DropTrigStmt
+{
+ NodeTag type;
+ char *trigname; /* TRIGGER' name */
+ char *relname; /* triggered relation */
+} DropTrigStmt;
/* ----------------------
- * Create SEQUENCE Statement
+ * Create SEQUENCE Statement
* ----------------------
*/
-typedef struct CreateSeqStmt {
- NodeTag type;
- char *seqname; /* the relation to create */
- List *options;
-} CreateSeqStmt;
+typedef struct CreateSeqStmt
+{
+ NodeTag type;
+ char *seqname; /* the relation to create */
+ List *options;
+} CreateSeqStmt;
/* ----------------------
- * Create Version Statement
+ * Create Version Statement
* ----------------------
*/
-typedef struct VersionStmt {
- NodeTag type;
- char *relname; /* the new relation */
- int direction; /* FORWARD | BACKWARD */
- char *fromRelname; /* relation to create a version */
- char *date; /* date of the snapshot */
-} VersionStmt;
+typedef struct VersionStmt
+{
+ NodeTag type;
+ char *relname; /* the new relation */
+ int direction; /* FORWARD | BACKWARD */
+ char *fromRelname;/* relation to create a version */
+ char *date; /* date of the snapshot */
+} VersionStmt;
/* ----------------------
- * Create {Operator|Type|Aggregate} Statement
+ * Create {Operator|Type|Aggregate} Statement
* ----------------------
*/
-typedef struct DefineStmt {
- NodeTag type;
- int defType; /* OPERATOR|P_TYPE|AGGREGATE*/
- char *defname;
- List *definition; /* a list of DefElem */
-} DefineStmt;
+typedef struct DefineStmt
+{
+ NodeTag type;
+ int defType; /* OPERATOR|P_TYPE|AGGREGATE */
+ char *defname;
+ List *definition; /* a list of DefElem */
+} DefineStmt;
/* ----------------------
- * Drop Table Statement
+ * Drop Table Statement
* ----------------------
*/
-typedef struct DestroyStmt {
- NodeTag type;
- List *relNames; /* relations to be dropped */
- bool sequence;
-} DestroyStmt;
+typedef struct DestroyStmt
+{
+ NodeTag type;
+ List *relNames; /* relations to be dropped */
+ bool sequence;
+} DestroyStmt;
/* ----------------------
- * Extend Index Statement
+ * Extend Index Statement
* ----------------------
*/
-typedef struct ExtendStmt {
- NodeTag type;
- char *idxname; /* name of the index */
- Node *whereClause; /* qualifications */
- List *rangetable; /* range table, filled in
- by transformStmt() */
-} ExtendStmt;
+typedef struct ExtendStmt
+{
+ NodeTag type;
+ char *idxname; /* name of the index */
+ Node *whereClause;/* qualifications */
+ List *rangetable; /* range table, filled in by
+ * transformStmt() */
+} ExtendStmt;
/* ----------------------
- * Begin Recipe Statement
+ * Begin Recipe Statement
* ----------------------
*/
-typedef struct RecipeStmt {
- NodeTag type;
- char *recipeName; /* name of the recipe*/
-} RecipeStmt;
+typedef struct RecipeStmt
+{
+ NodeTag type;
+ char *recipeName; /* name of the recipe */
+} RecipeStmt;
/* ----------------------
- * Fetch Statement
+ * Fetch Statement
* ----------------------
*/
-typedef struct FetchStmt {
- NodeTag type;
- int direction; /* FORWARD or BACKWARD */
- int howMany; /* amount to fetch ("ALL" --> 0) */
- char *portalname; /* name of portal (cursor) */
-} FetchStmt;
+typedef struct FetchStmt
+{
+ NodeTag type;
+ int direction; /* FORWARD or BACKWARD */
+ int howMany; /* amount to fetch ("ALL" --> 0) */
+ char *portalname; /* name of portal (cursor) */
+} FetchStmt;
/* ----------------------
- * Create Index Statement
+ * Create Index Statement
* ----------------------
*/
-typedef struct IndexStmt {
- NodeTag type;
- char *idxname; /* name of the index */
- char *relname; /* name of relation to index on */
- char *accessMethod; /* name of acess methood (eg. btree) */
- List *indexParams; /* a list of IndexElem */
- List *withClause; /* a list of ParamString */
- Node *whereClause; /* qualifications */
- List *rangetable; /* range table, filled in
- by transformStmt() */
- bool *lossy; /* is index lossy? */
- bool unique; /* is index unique? */
-} IndexStmt;
+typedef struct IndexStmt
+{
+ NodeTag type;
+ char *idxname; /* name of the index */
+ char *relname; /* name of relation to index on */
+ char *accessMethod; /* name of acess methood (eg.
+ * btree) */
+ List *indexParams;/* a list of IndexElem */
+ List *withClause; /* a list of ParamString */
+ Node *whereClause;/* qualifications */
+ List *rangetable; /* range table, filled in by
+ * transformStmt() */
+ bool *lossy; /* is index lossy? */
+ bool unique; /* is index unique? */
+} IndexStmt;
/* ----------------------
- * Move Statement (Not implemented)
+ * Move Statement (Not implemented)
* ----------------------
*/
-typedef struct MoveStmt {
- NodeTag type;
- int direction; /* FORWARD or BACKWARD */
- bool to;
- int where;
- char *portalname;
-} MoveStmt;
+typedef struct MoveStmt
+{
+ NodeTag type;
+ int direction; /* FORWARD or BACKWARD */
+ bool to;
+ int where;
+ char *portalname;
+} MoveStmt;
/* ----------------------
- * Create Function Statement
+ * Create Function Statement
* ----------------------
*/
-typedef struct ProcedureStmt {
- NodeTag type;
- char *funcname; /* name of function to create */
- List *defArgs; /* list of definitions
- a list of strings (as Value *) */
- Node *returnType; /* the return type (as a string or
- a TypeName (ie.setof) */
- List *withClause; /* a list of ParamString */
- char *as; /* the SQL statement or filename */
- char *language; /* C or SQL */
-} ProcedureStmt;
+typedef struct ProcedureStmt
+{
+ NodeTag type;
+ char *funcname; /* name of function to create */
+ List *defArgs; /* list of definitions a list of strings
+ * (as Value *) */
+ Node *returnType; /* the return type (as a string or a
+ * TypeName (ie.setof) */
+ List *withClause; /* a list of ParamString */
+ char *as; /* the SQL statement or filename */
+ char *language; /* C or SQL */
+} ProcedureStmt;
/* ----------------------
- * Purge Statement
+ * Purge Statement
* ----------------------
*/
-typedef struct PurgeStmt {
- NodeTag type;
- char *relname; /* relation to purge */
- char *beforeDate; /* purge before this date */
- char *afterDate; /* purge after this date */
-} PurgeStmt;
+typedef struct PurgeStmt
+{
+ NodeTag type;
+ char *relname; /* relation to purge */
+ char *beforeDate; /* purge before this date */
+ char *afterDate; /* purge after this date */
+} PurgeStmt;
/* ----------------------
- * Drop Aggregate Statement
+ * Drop Aggregate Statement
* ----------------------
*/
-typedef struct RemoveAggrStmt {
- NodeTag type;
- char *aggname; /* aggregate to drop */
- char *aggtype; /* for this type */
-} RemoveAggrStmt;
+typedef struct RemoveAggrStmt
+{
+ NodeTag type;
+ char *aggname; /* aggregate to drop */
+ char *aggtype; /* for this type */
+} RemoveAggrStmt;
/* ----------------------
- * Drop Function Statement
+ * Drop Function Statement
* ----------------------
*/
-typedef struct RemoveFuncStmt {
- NodeTag type;
- char *funcname; /* function to drop */
- List *args; /* types of the arguments */
-} RemoveFuncStmt;
+typedef struct RemoveFuncStmt
+{
+ NodeTag type;
+ char *funcname; /* function to drop */
+ List *args; /* types of the arguments */
+} RemoveFuncStmt;
/* ----------------------
- * Drop Operator Statement
+ * Drop Operator Statement
* ----------------------
*/
-typedef struct RemoveOperStmt {
- NodeTag type;
- char *opname; /* operator to drop */
- List *args; /* types of the arguments */
-} RemoveOperStmt;
+typedef struct RemoveOperStmt
+{
+ NodeTag type;
+ char *opname; /* operator to drop */
+ List *args; /* types of the arguments */
+} RemoveOperStmt;
/* ----------------------
- * Drop {Type|Index|Rule|View} Statement
+ * Drop {Type|Index|Rule|View} Statement
* ----------------------
*/
-typedef struct RemoveStmt {
- NodeTag type;
- int removeType; /* P_TYPE|INDEX|RULE|VIEW */
- char *name; /* name to drop */
-} RemoveStmt;
+typedef struct RemoveStmt
+{
+ NodeTag type;
+ int removeType; /* P_TYPE|INDEX|RULE|VIEW */
+ char *name; /* name to drop */
+} RemoveStmt;
/* ----------------------
- * Alter Table Statement
+ * Alter Table Statement
* ----------------------
*/
-typedef struct RenameStmt {
- NodeTag type;
- char *relname; /* relation to be altered */
- bool inh; /* recursively alter children? */
- char *column; /* if NULL, rename the relation name
- to the new name. Otherwise, rename
- this column name. */
- char *newname; /* the new name */
-} RenameStmt;
+typedef struct RenameStmt
+{
+ NodeTag type;
+ char *relname; /* relation to be altered */
+ bool inh; /* recursively alter children? */
+ char *column; /* if NULL, rename the relation name to
+ * the new name. Otherwise, rename this
+ * column name. */
+ char *newname; /* the new name */
+} RenameStmt;
/* ----------------------
- * Create Rule Statement
+ * Create Rule Statement
* ----------------------
*/
-typedef struct RuleStmt {
- NodeTag type;
- char *rulename; /* name of the rule */
- Node *whereClause; /* qualifications */
- CmdType event; /* RETRIEVE */
- struct Attr *object; /* object affected */
- bool instead; /* is a 'do instead'? */
- List *actions; /* the action statements */
-} RuleStmt;
+typedef struct RuleStmt
+{
+ NodeTag type;
+ char *rulename; /* name of the rule */
+ Node *whereClause;/* qualifications */
+ CmdType event; /* RETRIEVE */
+ struct Attr *object; /* object affected */
+ bool instead; /* is a 'do instead'? */
+ List *actions; /* the action statements */
+} RuleStmt;
/* ----------------------
- * Notify Statement
+ * Notify Statement
* ----------------------
*/
-typedef struct NotifyStmt {
- NodeTag type;
- char *relname; /* relation to notify */
-} NotifyStmt;
+typedef struct NotifyStmt
+{
+ NodeTag type;
+ char *relname; /* relation to notify */
+} NotifyStmt;
/* ----------------------
- * Listen Statement
+ * Listen Statement
* ----------------------
*/
-typedef struct ListenStmt {
- NodeTag type;
- char *relname; /* relation to listen on */
-} ListenStmt;
+typedef struct ListenStmt
+{
+ NodeTag type;
+ char *relname; /* relation to listen on */
+} ListenStmt;
/* ----------------------
- * {Begin|Abort|End} Transaction Statement
+ * {Begin|Abort|End} Transaction Statement
* ----------------------
*/
-typedef struct TransactionStmt {
- NodeTag type;
- int command; /* BEGIN|END|ABORT */
-} TransactionStmt;
+typedef struct TransactionStmt
+{
+ NodeTag type;
+ int command; /* BEGIN|END|ABORT */
+} TransactionStmt;
/* ----------------------
- * Create View Statement
+ * Create View Statement
* ----------------------
*/
-typedef struct ViewStmt {
- NodeTag type;
- char *viewname; /* name of the view */
- Query *query; /* the SQL statement */
-} ViewStmt;
+typedef struct ViewStmt
+{
+ NodeTag type;
+ char *viewname; /* name of the view */
+ Query *query; /* the SQL statement */
+} ViewStmt;
/* ----------------------
- * Load Statement
+ * Load Statement
* ----------------------
*/
-typedef struct LoadStmt {
- NodeTag type;
- char *filename; /* file to load */
-} LoadStmt;
+typedef struct LoadStmt
+{
+ NodeTag type;
+ char *filename; /* file to load */
+} LoadStmt;
/* ----------------------
- * Createdb Statement
+ * Createdb Statement
* ----------------------
*/
-typedef struct CreatedbStmt {
- NodeTag type;
- char *dbname; /* database to create */
-} CreatedbStmt;
+typedef struct CreatedbStmt
+{
+ NodeTag type;
+ char *dbname; /* database to create */
+} CreatedbStmt;
/* ----------------------
- * Destroydb Statement
+ * Destroydb Statement
* ----------------------
*/
-typedef struct DestroydbStmt {
- NodeTag type;
- char *dbname; /* database to drop */
-} DestroydbStmt;
+typedef struct DestroydbStmt
+{
+ NodeTag type;
+ char *dbname; /* database to drop */
+} DestroydbStmt;
/* ----------------------
- * Cluster Statement (support pbrown's cluster index implementation)
+ * Cluster Statement (support pbrown's cluster index implementation)
* ----------------------
*/
-typedef struct ClusterStmt {
- NodeTag type;
- char *relname; /* relation being indexed */
- char *indexname; /* original index defined */
-} ClusterStmt;
+typedef struct ClusterStmt
+{
+ NodeTag type;
+ char *relname; /* relation being indexed */
+ char *indexname; /* original index defined */
+} ClusterStmt;
/* ----------------------
- * Vacuum Statement
+ * Vacuum Statement
* ----------------------
*/
-typedef struct VacuumStmt {
- NodeTag type;
- bool verbose; /* print status info */
- bool analyze; /* analyze data */
- char *vacrel; /* table to vacuum */
- List *va_spec; /* columns to analyse */
-} VacuumStmt;
+typedef struct VacuumStmt
+{
+ NodeTag type;
+ bool verbose; /* print status info */
+ bool analyze; /* analyze data */
+ char *vacrel; /* table to vacuum */
+ List *va_spec; /* columns to analyse */
+} VacuumStmt;
/* ----------------------
- * Explain Statement
+ * Explain Statement
* ----------------------
*/
-typedef struct ExplainStmt {
- NodeTag type;
- Query *query; /* the query */
- bool verbose; /* print plan info */
-} ExplainStmt;
+typedef struct ExplainStmt
+{
+ NodeTag type;
+ Query *query; /* the query */
+ bool verbose; /* print plan info */
+} ExplainStmt;
/* ----------------------
* Set Statement
* ----------------------
*/
-typedef struct VariableSetStmt {
- NodeTag type;
- char *name;
- char *value;
-} VariableSetStmt;
+typedef struct VariableSetStmt
+{
+ NodeTag type;
+ char *name;
+ char *value;
+} VariableSetStmt;
/* ----------------------
* Show Statement
* ----------------------
*/
-typedef struct VariableShowStmt {
- NodeTag type;
- char *name;
-} VariableShowStmt;
+typedef struct VariableShowStmt
+{
+ NodeTag type;
+ char *name;
+} VariableShowStmt;
/* ----------------------
* Reset Statement
* ----------------------
*/
-typedef struct VariableResetStmt {
- NodeTag type;
- char *name;
-} VariableResetStmt;
+typedef struct VariableResetStmt
+{
+ NodeTag type;
+ char *name;
+} VariableResetStmt;
/*****************************************************************************
- * Optimizable Statements
+ * Optimizable Statements
*****************************************************************************/
/* ----------------------
- * Insert Statement
+ * Insert Statement
* ----------------------
*/
-typedef struct AppendStmt {
- NodeTag type;
- char *relname; /* relation to insert into */
- List *cols; /* names of the columns */
- List *targetList; /* the target list (of ResTarget) */
- List *fromClause; /* the from clause */
- Node *whereClause; /* qualifications */
-} AppendStmt;
+typedef struct AppendStmt
+{
+ NodeTag type;
+ char *relname; /* relation to insert into */
+ List *cols; /* names of the columns */
+ List *targetList; /* the target list (of ResTarget) */
+ List *fromClause; /* the from clause */
+ Node *whereClause;/* qualifications */
+} AppendStmt;
/* ----------------------
- * Delete Statement
+ * Delete Statement
* ----------------------
*/
-typedef struct DeleteStmt {
- NodeTag type;
- char *relname; /* relation to delete from */
- Node *whereClause; /* qualifications */
-} DeleteStmt;
+typedef struct DeleteStmt
+{
+ NodeTag type;
+ char *relname; /* relation to delete from */
+ Node *whereClause;/* qualifications */
+} DeleteStmt;
/* ----------------------
- * Update Statement
+ * Update Statement
* ----------------------
*/
-typedef struct ReplaceStmt {
- NodeTag type;
- char *relname; /* relation to update */
- List *targetList; /* the target list (of ResTarget) */
- Node *whereClause; /* qualifications */
- List *fromClause; /* the from clause */
-} ReplaceStmt;
+typedef struct ReplaceStmt
+{
+ NodeTag type;
+ char *relname; /* relation to update */
+ List *targetList; /* the target list (of ResTarget) */
+ Node *whereClause;/* qualifications */
+ List *fromClause; /* the from clause */
+} ReplaceStmt;
/* ----------------------
- * Create Cursor Statement
+ * Create Cursor Statement
* ----------------------
*/
-typedef struct CursorStmt {
- NodeTag type;
- char *portalname; /* the portal (cursor) to create */
- bool binary; /* a binary (internal) portal? */
- char *unique; /* NULL, "*", or unique attribute name */
- List *targetList; /* the target list (of ResTarget) */
- List *fromClause; /* the from clause */
- Node *whereClause; /* qualifications */
- List *groupClause; /* group by clause */
- List *sortClause; /* sort clause (a list of SortGroupBy's) */
-} CursorStmt;
+typedef struct CursorStmt
+{
+ NodeTag type;
+ char *portalname; /* the portal (cursor) to create */
+ bool binary; /* a binary (internal) portal? */
+ char *unique; /* NULL, "*", or unique attribute name */
+ List *targetList; /* the target list (of ResTarget) */
+ List *fromClause; /* the from clause */
+ Node *whereClause;/* qualifications */
+ List *groupClause;/* group by clause */
+ List *sortClause; /* sort clause (a list of SortGroupBy's) */
+} CursorStmt;
/* ----------------------
- * Select Statement
+ * Select Statement
* ----------------------
*/
-typedef struct RetrieveStmt {
- NodeTag type;
- char *unique; /* NULL, '*', or unique attribute name */
- char *into; /* name of table (for select into table) */
- List *targetList; /* the target list (of ResTarget) */
- List *fromClause; /* the from clause */
- Node *whereClause; /* qualifications */
- List *groupClause; /* group by clause */
- Node *havingClause; /* having conditional-expression */
- List *selectClause; /* subselect parameters */
- List *sortClause; /* sort clause (a list of SortGroupBy's) */
-} RetrieveStmt;
+typedef struct RetrieveStmt
+{
+ NodeTag type;
+ char *unique; /* NULL, '*', or unique attribute name */
+ char *into; /* name of table (for select into table) */
+ List *targetList; /* the target list (of ResTarget) */
+ List *fromClause; /* the from clause */
+ Node *whereClause;/* qualifications */
+ List *groupClause;/* group by clause */
+ Node *havingClause; /* having conditional-expression */
+ List *selectClause; /* subselect parameters */
+ List *sortClause; /* sort clause (a list of SortGroupBy's) */
+} RetrieveStmt;
/****************************************************************************
- * Supporting data structures for Parse Trees
+ * Supporting data structures for Parse Trees
****************************************************************************/
/*
* SubSelect - specifies subselect parameters
*/
-typedef struct SubSelect {
- NodeTag type;
- char *unique; /* NULL, '*', or unique attribute name */
- List *targetList; /* the target list (of ResTarget) */
- List *fromClause; /* the from clause */
- Node *whereClause; /* qualifications */
- List *groupClause; /* group by clause */
- Node *havingClause; /* having conditional-expression */
-} SubSelect;
+typedef struct SubSelect
+{
+ NodeTag type;
+ char *unique; /* NULL, '*', or unique attribute name */
+ List *targetList; /* the target list (of ResTarget) */
+ List *fromClause; /* the from clause */
+ Node *whereClause;/* qualifications */
+ List *groupClause;/* group by clause */
+ Node *havingClause; /* having conditional-expression */
+} SubSelect;
/*
* TypeName - specifies a type in definitions
*/
-typedef struct TypeName {
- NodeTag type;
- char *name; /* name of the type */
- bool timezone; /* timezone specified? */
- bool setof; /* is a set? */
- List *arrayBounds; /* array bounds */
- int typlen; /* length for char() and varchar() */
-} TypeName;
+typedef struct TypeName
+{
+ NodeTag type;
+ char *name; /* name of the type */
+ bool timezone; /* timezone specified? */
+ bool setof; /* is a set? */
+ List *arrayBounds;/* array bounds */
+ int typlen; /* length for char() and varchar() */
+} TypeName;
/*
* ParamNo - specifies a parameter reference
*/
-typedef struct ParamNo {
- NodeTag type;
- int number; /* the number of the parameter */
- TypeName *typename; /* the typecast */
-} ParamNo;
+typedef struct ParamNo
+{
+ NodeTag type;
+ int number; /* the number of the parameter */
+ TypeName *typename; /* the typecast */
+} ParamNo;
/*
* A_Expr - binary expressions
*/
-typedef struct A_Expr {
- NodeTag type;
- int oper; /* type of operation
- {OP,OR,AND,NOT,ISNULL,NOTNULL} */
- char *opname; /* name of operator/function */
- Node *lexpr; /* left argument */
- Node *rexpr; /* right argument */
-} A_Expr;
+typedef struct A_Expr
+{
+ NodeTag type;
+ int oper; /* type of operation
+ * {OP,OR,AND,NOT,ISNULL,NOTNULL} */
+ char *opname; /* name of operator/function */
+ Node *lexpr; /* left argument */
+ Node *rexpr; /* right argument */
+} A_Expr;
/*
* Attr -
- * specifies an Attribute (ie. a Column); could have nested dots or
- * array references.
+ * specifies an Attribute (ie. a Column); could have nested dots or
+ * array references.
*
*/
-typedef struct Attr {
- NodeTag type;
- char *relname; /* name of relation (can be "*") */
- ParamNo *paramNo; /* or a parameter */
- List *attrs; /* attributes (possibly nested);
- list of Values (strings) */
- List *indirection; /* array refs (list of A_Indices') */
-} Attr;
+typedef struct Attr
+{
+ NodeTag type;
+ char *relname; /* name of relation (can be "*") */
+ ParamNo *paramNo; /* or a parameter */
+ List *attrs; /* attributes (possibly nested); list of
+ * Values (strings) */
+ List *indirection;/* array refs (list of A_Indices') */
+} Attr;
/*
* A_Const - a constant expression
*/
-typedef struct A_Const {
- NodeTag type;
- Value val; /* the value (with the tag) */
- TypeName *typename; /* typecast */
-} A_Const;
+typedef struct A_Const
+{
+ NodeTag type;
+ Value val; /* the value (with the tag) */
+ TypeName *typename; /* typecast */
+} A_Const;
/*
* ColumnDef - column definition (used in various creates)
*/
-typedef struct ColumnDef {
- NodeTag type;
- char *colname; /* name of column */
- TypeName *typename; /* type of column */
- bool is_not_null; /* flag to NOT NULL constraint */
- char *defval; /* default value of column */
-} ColumnDef;
+typedef struct ColumnDef
+{
+ NodeTag type;
+ char *colname; /* name of column */
+ TypeName *typename; /* type of column */
+ bool is_not_null;/* flag to NOT NULL constraint */
+ char *defval; /* default value of column */
+} ColumnDef;
/*
- * Ident -
- * an identifier (could be an attribute or a relation name). Depending
- * on the context at transformStmt time, the identifier is treated as
- * either a relation name (in which case, isRel will be set) or an
- * attribute (in which case, it will be transformed into an Attr).
- */
-typedef struct Ident {
- NodeTag type;
- char *name; /* its name */
- List *indirection; /* array references */
- bool isRel; /* is a relation - filled in by
- transformExpr() */
-} Ident;
+ * Ident -
+ * an identifier (could be an attribute or a relation name). Depending
+ * on the context at transformStmt time, the identifier is treated as
+ * either a relation name (in which case, isRel will be set) or an
+ * attribute (in which case, it will be transformed into an Attr).
+ */
+typedef struct Ident
+{
+ NodeTag type;
+ char *name; /* its name */
+ List *indirection;/* array references */
+ bool isRel; /* is a relation - filled in by
+ * transformExpr() */
+} Ident;
/*
* FuncCall - a function/aggregate invocation
*/
-typedef struct FuncCall {
- NodeTag type;
- char *funcname; /* name of function */
- List *args; /* the arguments (list of exprs) */
-} FuncCall;
+typedef struct FuncCall
+{
+ NodeTag type;
+ char *funcname; /* name of function */
+ List *args; /* the arguments (list of exprs) */
+} FuncCall;
/*
* A_Indices - array reference or bounds ([lidx:uidx] or [uidx])
*/
-typedef struct A_Indices {
- NodeTag type;
- Node *lidx; /* could be NULL */
- Node *uidx;
-} A_Indices;
+typedef struct A_Indices
+{
+ NodeTag type;
+ Node *lidx; /* could be NULL */
+ Node *uidx;
+} A_Indices;
/*
- * ResTarget -
- * result target (used in target list of pre-transformed Parse trees)
- */
-typedef struct ResTarget {
- NodeTag type;
- char *name; /* name of the result column */
- List *indirection; /* array references */
- Node *val; /* the value of the result
- (A_Expr or Attr) (or A_Const) */
-} ResTarget;
+ * ResTarget -
+ * result target (used in target list of pre-transformed Parse trees)
+ */
+typedef struct ResTarget
+{
+ NodeTag type;
+ char *name; /* name of the result column */
+ List *indirection;/* array references */
+ Node *val; /* the value of the result (A_Expr or
+ * Attr) (or A_Const) */
+} ResTarget;
/*
* ParamString - used in with clauses
*/
-typedef struct ParamString {
- NodeTag type;
- char *name;
- char *val;
-} ParamString;
+typedef struct ParamString
+{
+ NodeTag type;
+ char *name;
+ char *val;
+} ParamString;
/*
* TimeRange - specifies a time range
*/
-typedef struct TimeRange {
- NodeTag type;
- char *startDate;
- char *endDate; /* snapshot if NULL */
-} TimeRange;
+typedef struct TimeRange
+{
+ NodeTag type;
+ char *startDate;
+ char *endDate; /* snapshot if NULL */
+} TimeRange;
/*
* RelExpr - relation expressions
*/
-typedef struct RelExpr {
- NodeTag type;
- char *relname; /* the relation name */
- bool inh; /* inheritance query */
- TimeRange *timeRange; /* the time range */
-} RelExpr;
+typedef struct RelExpr
+{
+ NodeTag type;
+ char *relname; /* the relation name */
+ bool inh; /* inheritance query */
+ TimeRange *timeRange; /* the time range */
+} RelExpr;
/*
* SortGroupBy - for order by clause
*/
-typedef struct SortGroupBy {
- NodeTag type;
- int resno; /* target number */
- char *range;
- char *name; /* name of column to sort on */
- char *useOp; /* operator to use */
-} SortGroupBy;
+typedef struct SortGroupBy
+{
+ NodeTag type;
+ int resno; /* target number */
+ char *range;
+ char *name; /* name of column to sort on */
+ char *useOp; /* operator to use */
+} SortGroupBy;
/*
* RangeVar - range variable, used in from clauses
*/
-typedef struct RangeVar {
- NodeTag type;
- RelExpr *relExpr; /* the relation expression */
- char *name; /* the name to be referenced
- (optional) */
-} RangeVar;
+typedef struct RangeVar
+{
+ NodeTag type;
+ RelExpr *relExpr; /* the relation expression */
+ char *name; /* the name to be referenced (optional) */
+} RangeVar;
/*
* IndexElem - index parameters (used in create index)
*/
-typedef struct IndexElem {
- NodeTag type;
- char *name; /* name of index */
- List *args; /* if not NULL, function index */
- char *class;
- TypeName *tname; /* type of index's keys (optional) */
-} IndexElem;
+typedef struct IndexElem
+{
+ NodeTag type;
+ char *name; /* name of index */
+ List *args; /* if not NULL, function index */
+ char *class;
+ TypeName *tname; /* type of index's keys (optional) */
+} IndexElem;
/*
* DefElem -
- * a definition (used in definition lists in the form of defname = arg)
+ * a definition (used in definition lists in the form of defname = arg)
*/
-typedef struct DefElem {
- NodeTag type;
- char *defname;
- Node *arg; /* a (Value *) or a (TypeName *) */
-} DefElem;
+typedef struct DefElem
+{
+ NodeTag type;
+ char *defname;
+ Node *arg; /* a (Value *) or a (TypeName *) */
+} DefElem;
/****************************************************************************
- * Nodes for a Query tree
+ * Nodes for a Query tree
****************************************************************************/
/*
* TargetEntry -
- * a target entry (used in the transformed target list)
+ * a target entry (used in the transformed target list)
*
* one of resdom or fjoin is not NULL. a target list is
- * ((<resdom | fjoin> expr) (<resdom | fjoin> expr) ...)
+ * ((<resdom | fjoin> expr) (<resdom | fjoin> expr) ...)
*/
-typedef struct TargetEntry {
- NodeTag type;
- Resdom *resdom; /* fjoin overload this to be a list??*/
- Fjoin *fjoin;
- Node *expr; /* can be a list too */
-} TargetEntry;
+typedef struct TargetEntry
+{
+ NodeTag type;
+ Resdom *resdom; /* fjoin overload this to be a list?? */
+ Fjoin *fjoin;
+ Node *expr; /* can be a list too */
+} TargetEntry;
/*
* RangeTblEntry -
- * used in range tables. Some of the following are only used in one of
- * the parsing, optimizing, execution stages.
+ * used in range tables. Some of the following are only used in one of
+ * the parsing, optimizing, execution stages.
*
- * inFromCl marks those range variables that are listed in the from clause.
- * In SQL, the targetlist can only refer to range variables listed in the
- * from clause but POSTQUEL allows you to refer to tables not specified, in
- * which case a range table entry will be generated. We use POSTQUEL
- * semantics which is more powerful. However, we need SQL semantics in
- * some cases (eg. when expanding a '*')
- */
-typedef struct RangeTblEntry {
- NodeTag type;
- char *relname; /* real name of the relation */
- TimeRange *timeRange; /* time range */
- char *refname; /* the reference name (specified in
- the from clause) */
- Oid relid;
- bool inh; /* inheritance? */
- bool archive; /* filled in by plan_archive */
- bool inFromCl; /* comes from From Clause */
- TimeQual timeQual; /* filled in by pg_plan */
-} RangeTblEntry;
+ * inFromCl marks those range variables that are listed in the from clause.
+ * In SQL, the targetlist can only refer to range variables listed in the
+ * from clause but POSTQUEL allows you to refer to tables not specified, in
+ * which case a range table entry will be generated. We use POSTQUEL
+ * semantics which is more powerful. However, we need SQL semantics in
+ * some cases (eg. when expanding a '*')
+ */
+typedef struct RangeTblEntry
+{
+ NodeTag type;
+ char *relname; /* real name of the relation */
+ TimeRange *timeRange; /* time range */
+ char *refname; /* the reference name (specified in the
+ * from clause) */
+ Oid relid;
+ bool inh; /* inheritance? */
+ bool archive; /* filled in by plan_archive */
+ bool inFromCl; /* comes from From Clause */
+ TimeQual timeQual; /* filled in by pg_plan */
+} RangeTblEntry;
/*
* SortClause -
- * used in the sort clause for retrieves and cursors
+ * used in the sort clause for retrieves and cursors
*/
-typedef struct SortClause {
- NodeTag type;
- Resdom *resdom; /* attributes in tlist to be sorted */
- Oid opoid; /* sort operators */
-} SortClause;
+typedef struct SortClause
+{
+ NodeTag type;
+ Resdom *resdom; /* attributes in tlist to be sorted */
+ Oid opoid; /* sort operators */
+} SortClause;
/*
* GroupClause -
- * used in the GROUP BY clause
+ * used in the GROUP BY clause
*/
-typedef struct GroupClause {
- NodeTag type;
- TargetEntry *entry; /* attributes to group on */
- Oid grpOpoid; /* the sort operator to use */
-} GroupClause;
+typedef struct GroupClause
+{
+ NodeTag type;
+ TargetEntry *entry; /* attributes to group on */
+ Oid grpOpoid; /* the sort operator to use */
+} GroupClause;
-#endif /* PARSENODES_H */
+#endif /* PARSENODES_H */
diff --git a/src/include/nodes/pg_list.h b/src/include/nodes/pg_list.h
index b3848fb59fa..9afe6dfac5e 100644
--- a/src/include/nodes/pg_list.h
+++ b/src/include/nodes/pg_list.h
@@ -1,116 +1,120 @@
/*-------------------------------------------------------------------------
*
* pg_list.h--
- * POSTGRES generic list package
+ * POSTGRES generic list package
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_list.h,v 1.5 1997/08/19 21:38:51 momjian Exp $
+ * $Id: pg_list.h,v 1.6 1997/09/07 04:58:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
-#ifndef PG_LIST_H
-#define PG_LIST_H
+#ifndef PG_LIST_H
+#define PG_LIST_H
#include <nodes/nodes.h>
/* ----------------------------------------------------------------
- * node definitions
+ * node definitions
* ----------------------------------------------------------------
*/
/*----------------------
- * Value node
+ * Value node
*----------------------
*/
-typedef struct Value {
- NodeTag type; /* tag appropriately (eg. T_String) */
- union ValUnion {
- char *str; /* string */
- long ival;
- double dval;
- } val;
-} Value;
-
-#define intVal(v) (((Value *)v)->val.ival)
-#define floatVal(v) (((Value *)v)->val.dval)
-#define strVal(v) (((Value *)v)->val.str)
+typedef struct Value
+{
+ NodeTag type; /* tag appropriately (eg. T_String) */
+ union ValUnion
+ {
+ char *str; /* string */
+ long ival;
+ double dval;
+ } val;
+} Value;
+
+#define intVal(v) (((Value *)v)->val.ival)
+#define floatVal(v) (((Value *)v)->val.dval)
+#define strVal(v) (((Value *)v)->val.str)
/*----------------------
- * List node
+ * List node
*----------------------
*/
-typedef struct List {
- NodeTag type;
- union {
- void *ptr_value;
- int int_value;
- } elem;
- struct List *next;
-} List;
-
-#define NIL ((List *) NULL)
+typedef struct List
+{
+ NodeTag type;
+ union
+ {
+ void *ptr_value;
+ int int_value;
+ } elem;
+ struct List *next;
+} List;
+
+#define NIL ((List *) NULL)
/* ----------------
- * accessor macros
+ * accessor macros
* ----------------
*/
/* anything that doesn't end in 'i' is assumed to be referring to the */
-/* pointer version of the list (where it makes a difference) */
-#define lfirst(l) ((l)->elem.ptr_value)
-#define lnext(l) ((l)->next)
-#define lsecond(l) (lfirst(lnext(l)))
+/* pointer version of the list (where it makes a difference) */
+#define lfirst(l) ((l)->elem.ptr_value)
+#define lnext(l) ((l)->next)
+#define lsecond(l) (lfirst(lnext(l)))
-#define lfirsti(l) ((l)->elem.int_value)
+#define lfirsti(l) ((l)->elem.int_value)
/*
* foreach -
- * a convenience macro which loops through the list
+ * a convenience macro which loops through the list
*/
-#define foreach(_elt_,_list_) \
- for(_elt_=_list_; _elt_!=NIL;_elt_=lnext(_elt_))
+#define foreach(_elt_,_list_) \
+ for(_elt_=_list_; _elt_!=NIL;_elt_=lnext(_elt_))
/*
* function prototypes in nodes/list.c
*/
-extern int length(List *list);
-extern List *append(List *list1, List *list2);
-extern List *nconc(List *list1, List *list2);
-extern List *lcons(void *datum, List *list);
-extern bool member(void *foo, List *bar);
-extern Value *makeInteger(long i);
-extern Value *makeFloat(double d);
-extern Value *makeString(char *str);
-extern List *makeList(void *elem, ...);
-extern List *lappend(List *list, void *obj);
-extern List *lremove(void *elem, List *list);
-extern void freeList(List *list);
-extern List *LispRemove(void *elem, List *list);
-
-extern void *nth(int n, List *l);
-extern void set_nth(List *l, int n, void *elem);
-
-List *lconsi(int datum, List *list);
-List *lappendi(List *list, int datum);
-extern bool intMember(int, List *);
-extern List *intAppend(List *list1, List *list2);
-
-extern int nthi(int n, List *l);
-
-extern List *nreverse(List *);
-extern List *set_difference(List *, List *);
-extern List *set_differencei(List *, List *);
-extern List *LispUnion(List *foo, List *bar);
-extern List *LispUnioni(List *foo, List *bar);
-extern bool same(List *foo, List *bar);
+extern int length(List * list);
+extern List *append(List * list1, List * list2);
+extern List *nconc(List * list1, List * list2);
+extern List *lcons(void *datum, List * list);
+extern bool member(void *foo, List * bar);
+extern Value *makeInteger(long i);
+extern Value *makeFloat(double d);
+extern Value *makeString(char *str);
+extern List *makeList(void *elem,...);
+extern List *lappend(List * list, void *obj);
+extern List *lremove(void *elem, List * list);
+extern void freeList(List * list);
+extern List *LispRemove(void *elem, List * list);
+
+extern void *nth(int n, List * l);
+extern void set_nth(List * l, int n, void *elem);
+
+List *lconsi(int datum, List * list);
+List *lappendi(List * list, int datum);
+extern bool intMember(int, List *);
+extern List *intAppend(List * list1, List * list2);
+
+extern int nthi(int n, List * l);
+
+extern List *nreverse(List *);
+extern List *set_difference(List *, List *);
+extern List *set_differencei(List *, List *);
+extern List *LispUnion(List * foo, List * bar);
+extern List *LispUnioni(List * foo, List * bar);
+extern bool same(List * foo, List * bar);
/* should be in nodes.h but needs List */
/* in copyfuncs.c */
-extern List *listCopy(List *);
+extern List *listCopy(List *);
-#endif /* PG_LIST_H */
+#endif /* PG_LIST_H */
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index 6e786c34f0e..3353602e02c 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.h
@@ -1,90 +1,91 @@
/*-------------------------------------------------------------------------
*
* plannodes.h--
- * definitions for query plan nodes
+ * definitions for query plan nodes
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: plannodes.h,v 1.6 1997/08/06 03:42:04 momjian Exp $
+ * $Id: plannodes.h,v 1.7 1997/09/07 04:58:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PLANNODES_H
-#define PLANNODES_H
+#define PLANNODES_H
#include <nodes/execnodes.h>
/* ----------------------------------------------------------------
- * Executor State types are used in the plannode structures
- * so we have to include their definitions too.
+ * Executor State types are used in the plannode structures
+ * so we have to include their definitions too.
*
- * Node Type node information used by executor
+ * Node Type node information used by executor
*
* control nodes
*
- * Existential ExistentialState exstate;
- * Result ResultState resstate;
- * Append AppendState unionstate;
+ * Existential ExistentialState exstate;
+ * Result ResultState resstate;
+ * Append AppendState unionstate;
*
* scan nodes
*
- * Scan *** CommonScanState scanstate;
- * IndexScan IndexScanState indxstate;
+ * Scan *** CommonScanState scanstate;
+ * IndexScan IndexScanState indxstate;
*
- * (*** nodes which inherit Scan also inherit scanstate)
+ * (*** nodes which inherit Scan also inherit scanstate)
*
* join nodes
*
- * NestLoop NestLoopState nlstate;
- * MergeJoin MergeJoinState mergestate;
- * HashJoin HashJoinState hashjoinstate;
+ * NestLoop NestLoopState nlstate;
+ * MergeJoin MergeJoinState mergestate;
+ * HashJoin HashJoinState hashjoinstate;
*
* materialize nodes
*
- * Material MaterialState matstate;
- * Sort SortState sortstate;
- * Unique UniqueState uniquestate;
- * Hash HashState hashstate;
+ * Material MaterialState matstate;
+ * Sort SortState sortstate;
+ * Unique UniqueState uniquestate;
+ * Hash HashState hashstate;
*
* ----------------------------------------------------------------
*/
/* ----------------------------------------------------------------
- * node definitions
+ * node definitions
* ----------------------------------------------------------------
*/
/* ----------------
- * Plan node
+ * Plan node
* ----------------
*/
-typedef struct Plan {
- NodeTag type;
- Cost cost;
- int plan_size;
- int plan_width;
- int plan_tupperpage;
- EState *state; /* at execution time, state's of individual
- nodes point to one EState for the
- whole top-level plan */
- List *targetlist;
- List *qual; /* Node* or List* ?? */
- struct Plan *lefttree;
- struct Plan *righttree;
-} Plan;
+typedef struct Plan
+{
+ NodeTag type;
+ Cost cost;
+ int plan_size;
+ int plan_width;
+ int plan_tupperpage;
+ EState *state; /* at execution time, state's of
+ * individual nodes point to one EState
+ * for the whole top-level plan */
+ List *targetlist;
+ List *qual; /* Node* or List* ?? */
+ struct Plan *lefttree;
+ struct Plan *righttree;
+} Plan;
/* ----------------
- * these are are defined to avoid confusion problems with "left"
- * and "right" and "inner" and "outer". The convention is that
- * the "left" plan is the "outer" plan and the "right" plan is
- * the inner plan, but these make the code more readable.
+ * these are are defined to avoid confusion problems with "left"
+ * and "right" and "inner" and "outer". The convention is that
+ * the "left" plan is the "outer" plan and the "right" plan is
+ * the inner plan, but these make the code more readable.
* ----------------
*/
-#define innerPlan(node) (((Plan *)(node))->righttree)
-#define outerPlan(node) (((Plan *)(node))->lefttree)
+#define innerPlan(node) (((Plan *)(node))->righttree)
+#define outerPlan(node) (((Plan *)(node))->lefttree)
/*
@@ -100,61 +101,65 @@ typedef struct Plan {
/* ----------------
- * existential node
+ * existential node
* ----------------
*/
typedef Plan Existential;
/* ----------------
- * result node -
- * returns tuples from outer plan that satisfy the qualifications
+ * result node -
+ * returns tuples from outer plan that satisfy the qualifications
* ----------------
*/
-typedef struct Result {
- Plan plan;
- Node *resconstantqual;
- ResultState *resstate;
-} Result;
+typedef struct Result
+{
+ Plan plan;
+ Node *resconstantqual;
+ ResultState *resstate;
+} Result;
/* ----------------
- * append node
+ * append node
* ----------------
*/
-typedef struct Append {
- Plan plan;
- List *unionplans;
- Index unionrelid;
- List *unionrtentries;
- AppendState *unionstate;
-} Append;
+typedef struct Append
+{
+ Plan plan;
+ List *unionplans;
+ Index unionrelid;
+ List *unionrtentries;
+ AppendState *unionstate;
+} Append;
/*
* ==========
* Scan nodes
* ==========
*/
-typedef struct Scan {
- Plan plan;
- Index scanrelid; /* relid is index into the range table */
- CommonScanState *scanstate;
-} Scan;
+typedef struct Scan
+{
+ Plan plan;
+ Index scanrelid; /* relid is index into the range table */
+ CommonScanState *scanstate;
+} Scan;
/* ----------------
- * sequential scan node
+ * sequential scan node
* ----------------
*/
typedef Scan SeqScan;
/* ----------------
- * index scan node
+ * index scan node
* ----------------
*/
-typedef struct IndexScan {
- Scan scan;
- List *indxid;
- List *indxqual;
- IndexScanState *indxstate;
-} IndexScan;
+typedef struct IndexScan
+{
+ Scan scan;
+ List *indxid;
+ List *indxqual;
+ IndexScanState *indxstate;
+} IndexScan;
/*
* ==========
@@ -163,165 +168,179 @@ typedef struct IndexScan {
*/
/* ----------------
- * Join node
+ * Join node
* ----------------
*/
-typedef Plan Join;
+typedef Plan Join;
/* ----------------
- * nest loop join node
+ * nest loop join node
* ----------------
*/
-typedef struct NestLoop {
- Join join;
- NestLoopState *nlstate;
-} NestLoop;
+typedef struct NestLoop
+{
+ Join join;
+ NestLoopState *nlstate;
+} NestLoop;
/* ----------------
- * merge join node
+ * merge join node
* ----------------
*/
-typedef struct MergeJoin {
- Join join;
- List *mergeclauses;
- Oid mergesortop;
- Oid *mergerightorder; /* inner sort operator */
- Oid *mergeleftorder; /* outer sort operator */
- MergeJoinState *mergestate;
-} MergeJoin;
+typedef struct MergeJoin
+{
+ Join join;
+ List *mergeclauses;
+ Oid mergesortop;
+ Oid *mergerightorder; /* inner sort operator */
+ Oid *mergeleftorder; /* outer sort operator */
+ MergeJoinState *mergestate;
+} MergeJoin;
/* ----------------
- * hash join (probe) node
+ * hash join (probe) node
* ----------------
*/
-typedef struct HashJoin {
- Join join;
- List *hashclauses;
- Oid hashjoinop;
- HashJoinState *hashjoinstate;
- HashJoinTable hashjointable;
- IpcMemoryKey hashjointablekey;
- int hashjointablesize;
- bool hashdone;
-} HashJoin;
+typedef struct HashJoin
+{
+ Join join;
+ List *hashclauses;
+ Oid hashjoinop;
+ HashJoinState *hashjoinstate;
+ HashJoinTable hashjointable;
+ IpcMemoryKey hashjointablekey;
+ int hashjointablesize;
+ bool hashdone;
+} HashJoin;
/* ---------------
- * aggregate node
+ * aggregate node
* ---------------
*/
-typedef struct Agg {
- Plan plan;
- int numAgg;
- Aggreg **aggs;
- AggState *aggstate;
-} Agg;
+typedef struct Agg
+{
+ Plan plan;
+ int numAgg;
+ Aggreg **aggs;
+ AggState *aggstate;
+} Agg;
/* ---------------
- * group node -
- * use for queries with GROUP BY specified.
+ * group node -
+ * use for queries with GROUP BY specified.
*
- * If tuplePerGroup is true, one tuple (with group columns only) is
- * returned for each group and NULL is returned when there are no more
- * groups. Otherwise, all the tuples of a group are returned with a
- * NULL returned at the end of each group. (see nodeGroup.c for details)
+ * If tuplePerGroup is true, one tuple (with group columns only) is
+ * returned for each group and NULL is returned when there are no more
+ * groups. Otherwise, all the tuples of a group are returned with a
+ * NULL returned at the end of each group. (see nodeGroup.c for details)
* ---------------
*/
-typedef struct Group {
- Plan plan;
- bool tuplePerGroup; /* what tuples to return (see above) */
- int numCols; /* number of group columns */
- AttrNumber *grpColIdx; /* index into the target list */
- GroupState *grpstate;
-} Group;
+typedef struct Group
+{
+ Plan plan;
+ bool tuplePerGroup; /* what tuples to return (see
+ * above) */
+ int numCols; /* number of group columns */
+ AttrNumber *grpColIdx; /* index into the target list */
+ GroupState *grpstate;
+} Group;
/*
* ==========
* Temp nodes
* ==========
*/
-typedef struct Temp {
- Plan plan;
- Oid tempid;
- int keycount;
-} Temp;
+typedef struct Temp
+{
+ Plan plan;
+ Oid tempid;
+ int keycount;
+} Temp;
/* ----------------
- * materialization node
+ * materialization node
* ----------------
*/
-typedef struct Material {
- Plan plan; /* temp node flattened out */
- Oid tempid;
- int keycount;
- MaterialState *matstate;
-} Material;
+typedef struct Material
+{
+ Plan plan; /* temp node flattened out */
+ Oid tempid;
+ int keycount;
+ MaterialState *matstate;
+} Material;
/* ----------------
- * sort node
+ * sort node
* ----------------
*/
-typedef struct Sort {
- Plan plan; /* temp node flattened out */
- Oid tempid;
- int keycount;
- SortState *sortstate;
- void *psortstate;
- bool cleaned;
-} Sort;
+typedef struct Sort
+{
+ Plan plan; /* temp node flattened out */
+ Oid tempid;
+ int keycount;
+ SortState *sortstate;
+ void *psortstate;
+ bool cleaned;
+} Sort;
/* ----------------
- * unique node
+ * unique node
* ----------------
*/
-typedef struct Unique {
- Plan plan; /* temp node flattened out */
- Oid tempid;
- int keycount;
- char *uniqueAttr; /* NULL if all attrs,
- or unique attribute name */
- AttrNumber uniqueAttrNum; /* attribute number of attribute
- to select distinct on */
- UniqueState *uniquestate;
-} Unique;
+typedef struct Unique
+{
+ Plan plan; /* temp node flattened out */
+ Oid tempid;
+ int keycount;
+ char *uniqueAttr; /* NULL if all attrs, or unique attribute
+ * name */
+ AttrNumber uniqueAttrNum; /* attribute number of attribute
+ * to select distinct on */
+ UniqueState *uniquestate;
+} Unique;
/* ----------------
- * hash build node
+ * hash build node
* ----------------
*/
-typedef struct Hash {
- Plan plan;
- Var *hashkey;
- HashState *hashstate;
- HashJoinTable hashtable;
- IpcMemoryKey hashtablekey;
- int hashtablesize;
-} Hash;
+typedef struct Hash
+{
+ Plan plan;
+ Var *hashkey;
+ HashState *hashstate;
+ HashJoinTable hashtable;
+ IpcMemoryKey hashtablekey;
+ int hashtablesize;
+} Hash;
/* ---------------------
- * choose node
+ * choose node
* ---------------------
*/
-typedef struct Choose {
- Plan plan;
- List *chooseplanlist;
-} Choose;
+typedef struct Choose
+{
+ Plan plan;
+ List *chooseplanlist;
+} Choose;
/* -------------------
- * Tee node information
+ * Tee node information
*
- * leftParent : the left parent of this node
- * rightParent: the right parent of this node
+ * leftParent : the left parent of this node
+ * rightParent: the right parent of this node
* -------------------
*/
-typedef struct Tee {
- Plan plan;
- Plan* leftParent;
- Plan* rightParent;
- TeeState *teestate;
- char *teeTableName; /* the name of the table to materialize
- the tee into */
- List *rtentries; /* the range table for the plan below the Tee
- may be different than the parent plans */
-} Tee;
-
-#endif /* PLANNODES_H */
+typedef struct Tee
+{
+ Plan plan;
+ Plan *leftParent;
+ Plan *rightParent;
+ TeeState *teestate;
+ char *teeTableName; /* the name of the table to
+ * materialize the tee into */
+ List *rtentries; /* the range table for the plan below the
+ * Tee may be different than the parent
+ * plans */
+} Tee;
+
+#endif /* PLANNODES_H */
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index cd30f229c9c..66d5a52a17e 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -1,312 +1,324 @@
/*-------------------------------------------------------------------------
*
* primnodes.h--
- * Definitions for parse tree/query tree ("primitive") nodes.
+ * Definitions for parse tree/query tree ("primitive") nodes.
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: primnodes.h,v 1.7 1997/01/22 01:43:44 momjian Exp $
+ * $Id: primnodes.h,v 1.8 1997/09/07 04:58:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PRIMNODES_H
-#define PRIMNODES_H
+#define PRIMNODES_H
#include <utils/fcache.h>
#include <access/attnum.h>
#include <nodes/pg_list.h>
/* ----------------------------------------------------------------
- * node definitions
+ * node definitions
* ----------------------------------------------------------------
*/
/* ----------------
* Resdom (Result Domain)
- * resno - attribute number
- * restype - type of the resdom
- * reslen - length (in bytes) of the result
- * resname - name of the resdom (could be NULL)
- * reskey - order of key in a sort (for those > 0)
- * reskeyop - sort operator Oid
- * resjunk - set to nonzero to eliminate the attribute
- * from final target list e.g., ctid for replace
- * and delete
+ * resno - attribute number
+ * restype - type of the resdom
+ * reslen - length (in bytes) of the result
+ * resname - name of the resdom (could be NULL)
+ * reskey - order of key in a sort (for those > 0)
+ * reskeyop - sort operator Oid
+ * resjunk - set to nonzero to eliminate the attribute
+ * from final target list e.g., ctid for replace
+ * and delete
*
* ----------------
*/
-typedef struct Resdom {
- NodeTag type;
- AttrNumber resno;
- Oid restype;
- int reslen;
- char *resname;
- Index reskey;
- Oid reskeyop;
- int resjunk;
-} Resdom;
+typedef struct Resdom
+{
+ NodeTag type;
+ AttrNumber resno;
+ Oid restype;
+ int reslen;
+ char *resname;
+ Index reskey;
+ Oid reskeyop;
+ int resjunk;
+} Resdom;
/* -------------
* Fjoin
- * initialized - true if the Fjoin has already been initialized for
- * the current target list evaluation
- * nNodes - The number of Iter nodes returning sets that the
- * node will flatten
- * outerList - 1 or more Iter nodes
- * inner - exactly one Iter node. We eval every node in the
- * outerList once then eval the inner node to completion
- * pair the outerList result vector with each inner
- * result to form the full result. When the inner has
- * been exhausted, we get the next outer result vector
- * and reset the inner.
- * results - The complete (flattened) result vector
- * alwaysNull - a null vector to indicate sets with a cardinality of
- * 0, we treat them as the set {NULL}.
+ * initialized - true if the Fjoin has already been initialized for
+ * the current target list evaluation
+ * nNodes - The number of Iter nodes returning sets that the
+ * node will flatten
+ * outerList - 1 or more Iter nodes
+ * inner - exactly one Iter node. We eval every node in the
+ * outerList once then eval the inner node to completion
+ * pair the outerList result vector with each inner
+ * result to form the full result. When the inner has
+ * been exhausted, we get the next outer result vector
+ * and reset the inner.
+ * results - The complete (flattened) result vector
+ * alwaysNull - a null vector to indicate sets with a cardinality of
+ * 0, we treat them as the set {NULL}.
*/
-typedef struct Fjoin {
- NodeTag type;
- bool fj_initialized;
- int fj_nNodes;
- List *fj_innerNode;
- DatumPtr fj_results;
- BoolPtr fj_alwaysDone;
-} Fjoin;
+typedef struct Fjoin
+{
+ NodeTag type;
+ bool fj_initialized;
+ int fj_nNodes;
+ List *fj_innerNode;
+ DatumPtr fj_results;
+ BoolPtr fj_alwaysDone;
+} Fjoin;
/* ----------------
* Expr
- * typeOid - oid of the type of this expression
- * opType - type of this expression
- * oper - the Oper node if it is an OPER_EXPR or the
- * Func node if it is a FUNC_EXPR
- * args - arguments to this expression
+ * typeOid - oid of the type of this expression
+ * opType - type of this expression
+ * oper - the Oper node if it is an OPER_EXPR or the
+ * Func node if it is a FUNC_EXPR
+ * args - arguments to this expression
* ----------------
*/
-typedef enum OpType {
- OP_EXPR, FUNC_EXPR, OR_EXPR, AND_EXPR, NOT_EXPR
-} OpType;
+typedef enum OpType
+{
+ OP_EXPR, FUNC_EXPR, OR_EXPR, AND_EXPR, NOT_EXPR
+} OpType;
-typedef struct Expr {
- NodeTag type;
- Oid typeOid; /* oid of the type of this expr */
- OpType opType; /* type of the op */
- Node *oper; /* could be Oper or Func */
- List *args; /* list of argument nodes */
-} Expr;
+typedef struct Expr
+{
+ NodeTag type;
+ Oid typeOid; /* oid of the type of this expr */
+ OpType opType; /* type of the op */
+ Node *oper; /* could be Oper or Func */
+ List *args; /* list of argument nodes */
+} Expr;
/* ----------------
* Var
- * varno - index of this var's relation in the range table
- * (could be INNER or OUTER)
- * varattno - attribute number of this var, or zero for all
- * vartype - pg_type tuple oid for the type of this var
- * varnoold - keep varno around in case it got changed to INNER/
- * OUTER (see match_varid)
- * varoattno - attribute number of this var
- * [ '(varnoold varoattno) was varid -ay 2/95]
+ * varno - index of this var's relation in the range table
+ * (could be INNER or OUTER)
+ * varattno - attribute number of this var, or zero for all
+ * vartype - pg_type tuple oid for the type of this var
+ * varnoold - keep varno around in case it got changed to INNER/
+ * OUTER (see match_varid)
+ * varoattno - attribute number of this var
+ * [ '(varnoold varoattno) was varid -ay 2/95]
* ----------------
*/
-#define INNER 65000
-#define OUTER 65001
+#define INNER 65000
+#define OUTER 65001
-#define PRS2_CURRENT_VARNO 1
-#define PRS2_NEW_VARNO 2
+#define PRS2_CURRENT_VARNO 1
+#define PRS2_NEW_VARNO 2
-typedef struct Var {
- NodeTag type;
- Index varno;
- AttrNumber varattno;
- Oid vartype;
- Index varnoold; /* only used by optimizer */
- AttrNumber varoattno; /* only used by optimizer */
-} Var;
+typedef struct Var
+{
+ NodeTag type;
+ Index varno;
+ AttrNumber varattno;
+ Oid vartype;
+ Index varnoold; /* only used by optimizer */
+ AttrNumber varoattno; /* only used by optimizer */
+} Var;
/* ----------------
* Oper
- * opno - PG_OPERATOR OID of the operator
- * opid - PG_PROC OID for the operator
- * opresulttype - PG_TYPE OID of the operator's return value
- * opsize - size of return result (cached by executor)
- * op_fcache - XXX comment me.
+ * opno - PG_OPERATOR OID of the operator
+ * opid - PG_PROC OID for the operator
+ * opresulttype - PG_TYPE OID of the operator's return value
+ * opsize - size of return result (cached by executor)
+ * op_fcache - XXX comment me.
*
* ----
* NOTE: in the good old days 'opno' used to be both (or either, or
- * neither) the pg_operator oid, and/or the pg_proc oid depending
+ * neither) the pg_operator oid, and/or the pg_proc oid depending
* on the postgres module in question (parser->pg_operator,
* executor->pg_proc, planner->both), the mood of the programmer,
* and the phase of the moon (rumors that it was also depending on the day
* of the week are probably false). To make things even more postgres-like
* (i.e. a mess) some comments were referring to 'opno' using the name
* 'opid'. Anyway, now we have two separate fields, and of course that
- * immediately removes all bugs from the code... [ sp :-) ].
+ * immediately removes all bugs from the code... [ sp :-) ].
* ----------------
*/
-typedef struct Oper {
- NodeTag type;
- Oid opno;
- Oid opid;
- Oid opresulttype;
- int opsize;
- FunctionCachePtr op_fcache;
-} Oper;
+typedef struct Oper
+{
+ NodeTag type;
+ Oid opno;
+ Oid opid;
+ Oid opresulttype;
+ int opsize;
+ FunctionCachePtr op_fcache;
+} Oper;
/* ----------------
* Const
- * consttype - PG_TYPE OID of the constant's value
- * constlen - length in bytes of the constant's value
- * constvalue - the constant's value
- * constisnull - whether the constant is null
- * (if true, the other fields are undefined)
- * constbyval - whether the information in constvalue
- * if passed by value. If true, then all the information
- * is stored in the datum. If false, then the datum
- * contains a pointer to the information.
- * constisset - whether the const represents a set. The const
- * value corresponding will be the query that defines
- * the set.
+ * consttype - PG_TYPE OID of the constant's value
+ * constlen - length in bytes of the constant's value
+ * constvalue - the constant's value
+ * constisnull - whether the constant is null
+ * (if true, the other fields are undefined)
+ * constbyval - whether the information in constvalue
+ * if passed by value. If true, then all the information
+ * is stored in the datum. If false, then the datum
+ * contains a pointer to the information.
+ * constisset - whether the const represents a set. The const
+ * value corresponding will be the query that defines
+ * the set.
* ----------------
*/
-typedef struct Const {
- NodeTag type;
- Oid consttype;
- Size constlen;
- Datum constvalue;
- bool constisnull;
- bool constbyval;
- bool constisset;
- bool constiscast;
-} Const;
+typedef struct Const
+{
+ NodeTag type;
+ Oid consttype;
+ Size constlen;
+ Datum constvalue;
+ bool constisnull;
+ bool constbyval;
+ bool constisset;
+ bool constiscast;
+} Const;
/* ----------------
* Param
- * paramkind - specifies the kind of parameter. The possible values
- * for this field are specified in "params.h", and they are:
+ * paramkind - specifies the kind of parameter. The possible values
+ * for this field are specified in "params.h", and they are:
*
- * PARAM_NAMED: The parameter has a name, i.e. something
- * like `$.salary' or `$.foobar'.
- * In this case field `paramname' must be a valid Name.
+ * PARAM_NAMED: The parameter has a name, i.e. something
+ * like `$.salary' or `$.foobar'.
+ * In this case field `paramname' must be a valid Name.
*
- * PARAM_NUM: The parameter has only a numeric identifier,
- * i.e. something like `$1', `$2' etc.
- * The number is contained in the `paramid' field.
+ * PARAM_NUM: The parameter has only a numeric identifier,
+ * i.e. something like `$1', `$2' etc.
+ * The number is contained in the `paramid' field.
*
- * PARAM_NEW: Used in PRS2 rule, similar to PARAM_NAMED.
- * The `paramname' and `paramid' refer to the "NEW" tuple
- * The `pramname' is the attribute name and `paramid'
- * is the attribute number.
+ * PARAM_NEW: Used in PRS2 rule, similar to PARAM_NAMED.
+ * The `paramname' and `paramid' refer to the "NEW" tuple
+ * The `pramname' is the attribute name and `paramid'
+ * is the attribute number.
*
- * PARAM_OLD: Same as PARAM_NEW, but in this case we refer to
- * the "OLD" tuple.
+ * PARAM_OLD: Same as PARAM_NEW, but in this case we refer to
+ * the "OLD" tuple.
*
- * paramid - numeric identifier for literal-constant parameters ("$1")
- * paramname - attribute name for tuple-substitution parameters ("$.foo")
- * paramtype - PG_TYPE OID of the parameter's value
- * param_tlist - allows for projection in a param node.
+ * paramid - numeric identifier for literal-constant parameters ("$1")
+ * paramname - attribute name for tuple-substitution parameters ("$.foo")
+ * paramtype - PG_TYPE OID of the parameter's value
+ * param_tlist - allows for projection in a param node.
* ----------------
*/
-typedef struct Param {
- NodeTag type;
- int paramkind;
- AttrNumber paramid;
- char *paramname;
- Oid paramtype;
- List *param_tlist;
-} Param;
+typedef struct Param
+{
+ NodeTag type;
+ int paramkind;
+ AttrNumber paramid;
+ char *paramname;
+ Oid paramtype;
+ List *param_tlist;
+} Param;
/* ----------------
* Func
- * funcid - PG_FUNCTION OID of the function
- * functype - PG_TYPE OID of the function's return value
- * funcisindex - the function can be evaluated by scanning an index
- * (set during query optimization)
- * funcsize - size of return result (cached by executor)
- * func_fcache - runtime state while running this function. Where
- * we are in the execution of the function if it
- * returns more than one value, etc.
- * See utils/fcache.h
- * func_tlist - projection of functions returning tuples
- * func_planlist - result of planning this func, if it's a PQ func
+ * funcid - PG_FUNCTION OID of the function
+ * functype - PG_TYPE OID of the function's return value
+ * funcisindex - the function can be evaluated by scanning an index
+ * (set during query optimization)
+ * funcsize - size of return result (cached by executor)
+ * func_fcache - runtime state while running this function. Where
+ * we are in the execution of the function if it
+ * returns more than one value, etc.
+ * See utils/fcache.h
+ * func_tlist - projection of functions returning tuples
+ * func_planlist - result of planning this func, if it's a PQ func
* ----------------
*/
-typedef struct Func {
- NodeTag type;
- Oid funcid;
- Oid functype;
- bool funcisindex;
- int funcsize;
- FunctionCachePtr func_fcache;
- List *func_tlist;
- List *func_planlist;
-} Func;
+typedef struct Func
+{
+ NodeTag type;
+ Oid funcid;
+ Oid functype;
+ bool funcisindex;
+ int funcsize;
+ FunctionCachePtr func_fcache;
+ List *func_tlist;
+ List *func_planlist;
+} Func;
/* ----------------
* Aggreg
- * aggname - name of the aggregate
- * basetype - base type Oid of the aggregate
- * aggtype - type Oid of final result of the aggregate
- * query - XXX comment me
- * target - XXX comment me
+ * aggname - name of the aggregate
+ * basetype - base type Oid of the aggregate
+ * aggtype - type Oid of final result of the aggregate
+ * query - XXX comment me
+ * target - XXX comment me
* ----------------
*/
-typedef struct Aggreg {
- NodeTag type;
- char *aggname;
- Oid basetype; /* base type of the aggregate */
- Oid aggtype; /* type of final result */
- Node *target; /* attribute to aggreg on */
- int aggno; /* index to ecxt_values */
-} Aggreg;
+typedef struct Aggreg
+{
+ NodeTag type;
+ char *aggname;
+ Oid basetype; /* base type of the aggregate */
+ Oid aggtype; /* type of final result */
+ Node *target; /* attribute to aggreg on */
+ int aggno; /* index to ecxt_values */
+} Aggreg;
/* ----------------
* Array
- * arrayelemtype - base type of the array's elements (homogenous!)
- * arrayelemlength - length of that type
- * arrayelembyval - can you pass this element by value?
- * arrayndim - number of dimensions of the array
- * arraylow - base for array indexing
- * arrayhigh - limit for array indexing
- * arraylen -
+ * arrayelemtype - base type of the array's elements (homogenous!)
+ * arrayelemlength - length of that type
+ * arrayelembyval - can you pass this element by value?
+ * arrayndim - number of dimensions of the array
+ * arraylow - base for array indexing
+ * arrayhigh - limit for array indexing
+ * arraylen -
* ----------------
*
- * memo from mao: the array support we inherited from 3.1 is just
- * wrong. when time exists, we should redesign this stuff to get
- * around a bunch of unfortunate implementation decisions made there.
+ * memo from mao: the array support we inherited from 3.1 is just
+ * wrong. when time exists, we should redesign this stuff to get
+ * around a bunch of unfortunate implementation decisions made there.
*/
-typedef struct Array {
- NodeTag type;
- Oid arrayelemtype;
- int arrayelemlength;
- bool arrayelembyval;
- int arrayndim;
- IntArray arraylow;
- IntArray arrayhigh;
- int arraylen;
-} Array;
+typedef struct Array
+{
+ NodeTag type;
+ Oid arrayelemtype;
+ int arrayelemlength;
+ bool arrayelembyval;
+ int arrayndim;
+ IntArray arraylow;
+ IntArray arrayhigh;
+ int arraylen;
+} Array;
/* ----------------
- * ArrayRef:
- * refelemtype - type of the element referenced here
- * refelemlength - length of that type
- * refelembyval - can you pass this element type by value?
- * refupperindexpr - expressions that evaluate to upper array index
- * reflowerexpr- the expressions that evaluate to a lower array index
- * refexpr - the expression that evaluates to an array
- * refassignexpr- the expression that evaluates to the new value
- * to be assigned to the array in case of replace.
+ * ArrayRef:
+ * refelemtype - type of the element referenced here
+ * refelemlength - length of that type
+ * refelembyval - can you pass this element type by value?
+ * refupperindexpr - expressions that evaluate to upper array index
+ * reflowerexpr- the expressions that evaluate to a lower array index
+ * refexpr - the expression that evaluates to an array
+ * refassignexpr- the expression that evaluates to the new value
+ * to be assigned to the array in case of replace.
* ----------------
*/
-typedef struct ArrayRef {
- NodeTag type;
- int refattrlength;
- int refelemlength;
- Oid refelemtype;
- bool refelembyval;
- List *refupperindexpr;
- List *reflowerindexpr;
- Node *refexpr;
- Node *refassgnexpr;
-} ArrayRef;
+typedef struct ArrayRef
+{
+ NodeTag type;
+ int refattrlength;
+ int refelemlength;
+ Oid refelemtype;
+ bool refelembyval;
+ List *refupperindexpr;
+ List *reflowerindexpr;
+ Node *refexpr;
+ Node *refassgnexpr;
+} ArrayRef;
-#endif /* PRIMNODES_H */
+#endif /* PRIMNODES_H */
diff --git a/src/include/nodes/print.h b/src/include/nodes/print.h
index 0e2585f1de1..8e1a80267d0 100644
--- a/src/include/nodes/print.h
+++ b/src/include/nodes/print.h
@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* execnodes.h--
- * definitions for executor state nodes
+ * definitions for executor state nodes
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: print.h,v 1.2 1997/08/19 21:38:54 momjian Exp $
+ * $Id: print.h,v 1.3 1997/09/07 04:58:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,15 +19,16 @@
#include "nodes/relation.h"
#include "executor/tuptable.h"
-extern void print(void *obj);
-extern void pprint(void *obj);
-extern void print_rt(List *rtable);
-extern void print_expr(Node *expr, List *rtable);
-extern void print_keys(List *keys, List *rtable);
-extern void print_tl(List *tlist, List *rtable);
-extern void print_slot(TupleTableSlot *slot);
-extern void print_plan_recursive (Plan* p, Query *parsetree,
- int indentLevel, char* label);
-extern void print_plan (Plan* p, Query* parsetree);
+extern void print(void *obj);
+extern void pprint(void *obj);
+extern void print_rt(List * rtable);
+extern void print_expr(Node * expr, List * rtable);
+extern void print_keys(List * keys, List * rtable);
+extern void print_tl(List * tlist, List * rtable);
+extern void print_slot(TupleTableSlot * slot);
+extern void
+print_plan_recursive(Plan * p, Query * parsetree,
+ int indentLevel, char *label);
+extern void print_plan(Plan * p, Query * parsetree);
-#endif /* PRINT_H */
+#endif /* PRINT_H */
diff --git a/src/include/nodes/readfuncs.h b/src/include/nodes/readfuncs.h
index 79e18ff61b7..8a23d550a90 100644
--- a/src/include/nodes/readfuncs.h
+++ b/src/include/nodes/readfuncs.h
@@ -1,27 +1,27 @@
/*-------------------------------------------------------------------------
*
* readfuncs.h--
- * header file for read.c and readfuncs.c. These functions are internal
- * to the stringToNode interface and should not be used by anyone else.
+ * header file for read.c and readfuncs.c. These functions are internal
+ * to the stringToNode interface and should not be used by anyone else.
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: readfuncs.h,v 1.2 1996/11/10 03:05:30 momjian Exp $
+ * $Id: readfuncs.h,v 1.3 1997/09/07 04:58:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
-#ifndef READFUNCS_H
-#define READFUNCS_H
+#ifndef READFUNCS_H
+#define READFUNCS_H
/*
* prototypes for functions in read.c (the lisp token parser)
*/
-extern char *lsptok(char *string, int *length);
-extern void *nodeRead(bool read_car_only);
+extern char *lsptok(char *string, int *length);
+extern void *nodeRead(bool read_car_only);
/*
- * prototypes for functions in readfuncs.c
+ * prototypes for functions in readfuncs.c
*/
-extern Node *parsePlanString(void);
+extern Node *parsePlanString(void);
-#endif /* READFUNCS_H */
+#endif /* READFUNCS_H */
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index 16c7dd29955..7acbc3d466c 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.h
@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* relation.h--
- * Definitions for internal planner nodes.
+ * Definitions for internal planner nodes.
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: relation.h,v 1.4 1997/03/18 18:41:37 scrappy Exp $
+ * $Id: relation.h,v 1.5 1997/09/07 04:58:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,260 +18,280 @@
/*
* Relid
- * List of relation identifiers (indexes into the rangetable).
+ * List of relation identifiers (indexes into the rangetable).
*/
-typedef List *Relid;
+typedef List *Relid;
/*
* Rel
- * Per-base-relation information
+ * Per-base-relation information
*
- * Parts of this data structure are specific to various scan and join
- * mechanisms. It didn't seem worth creating new node types for them.
+ * Parts of this data structure are specific to various scan and join
+ * mechanisms. It didn't seem worth creating new node types for them.
*
- * relids - List of relation indentifiers
- * indexed - true if the relation has secondary indices
- * pages - number of pages in the relation
- * tuples - number of tuples in the relation
- * size - number of tuples in the relation after restrictions clauses
- * have been applied
- * width - number of bytes per tuple in the relation after the
- * appropriate projections have been done
- * targetlist - List of TargetList nodes
- * pathlist - List of Path nodes, one for each possible method of
- * generating the relation
- * unorderedpath - a Path node generating this relation whose resulting
- * tuples are unordered (this isn't necessarily a
- * sequential scan path, e.g., scanning with a hash index
- * leaves the tuples unordered)
- * cheapestpath - least expensive Path (regardless of final order)
- * pruneable - flag to let the planner know whether it can prune the plan
- * space of this Rel or not. -- JMH, 11/11/92
+ * relids - List of relation indentifiers
+ * indexed - true if the relation has secondary indices
+ * pages - number of pages in the relation
+ * tuples - number of tuples in the relation
+ * size - number of tuples in the relation after restrictions clauses
+ * have been applied
+ * width - number of bytes per tuple in the relation after the
+ * appropriate projections have been done
+ * targetlist - List of TargetList nodes
+ * pathlist - List of Path nodes, one for each possible method of
+ * generating the relation
+ * unorderedpath - a Path node generating this relation whose resulting
+ * tuples are unordered (this isn't necessarily a
+ * sequential scan path, e.g., scanning with a hash index
+ * leaves the tuples unordered)
+ * cheapestpath - least expensive Path (regardless of final order)
+ * pruneable - flag to let the planner know whether it can prune the plan
+ * space of this Rel or not. -- JMH, 11/11/92
*
- * * If the relation is a (secondary) index it will have the following
- * three fields:
+ * * If the relation is a (secondary) index it will have the following
+ * three fields:
*
- * classlist - List of PG_AMOPCLASS OIDs for the index
- * indexkeys - List of base-relation attribute numbers that are index keys
- * ordering - List of PG_OPERATOR OIDs which order the indexscan result
- * relam - the OID of the pg_am of the index
+ * classlist - List of PG_AMOPCLASS OIDs for the index
+ * indexkeys - List of base-relation attribute numbers that are index keys
+ * ordering - List of PG_OPERATOR OIDs which order the indexscan result
+ * relam - the OID of the pg_am of the index
*
- * * The presence of the remaining fields depends on the restrictions
- * and joins which the relation participates in:
+ * * The presence of the remaining fields depends on the restrictions
+ * and joins which the relation participates in:
*
- * clauseinfo - List of ClauseInfo nodes, containing info about each
- * qualification clause in which this relation participates
- * joininfo - List of JoinInfo nodes, containing info about each join
- * clause in which this relation participates
- * innerjoin - List of Path nodes that represent indices that may be used
- * as inner paths of nestloop joins
+ * clauseinfo - List of ClauseInfo nodes, containing info about each
+ * qualification clause in which this relation participates
+ * joininfo - List of JoinInfo nodes, containing info about each join
+ * clause in which this relation participates
+ * innerjoin - List of Path nodes that represent indices that may be used
+ * as inner paths of nestloop joins
*
* NB. the last element of the arrays classlist, indexkeys and ordering
- * is always 0. 2/95 - ay
+ * is always 0. 2/95 - ay
*/
-typedef struct Rel {
- NodeTag type;
-
- /* all relations: */
- Relid relids;
-
- /* catalog statistics information */
- bool indexed;
- int pages;
- int tuples;
- int size;
- int width;
-
- /* materialization information */
- List *targetlist;
- List *pathlist;
- struct Path *unorderedpath;
- struct Path *cheapestpath;
- bool pruneable;
-
- /* used solely by indices: */
- Oid *classlist; /* classes of AM operators */
- int *indexkeys; /* keys over which we're indexing */
- Oid relam; /* OID of the access method (in pg_am) */
-
- Oid indproc;
- List *indpred;
-
- /* used by various scans and joins: */
- Oid *ordering; /* OID of operators in sort order */
- List *clauseinfo; /* restriction clauses */
- List *joininfo; /* join clauses */
- List *innerjoin;
- List *superrels;
-} Rel;
-
-extern Var *get_expr(TargetEntry *foo);
-
-typedef struct MergeOrder {
- NodeTag type;
- Oid join_operator;
- Oid left_operator;
- Oid right_operator;
- Oid left_type;
- Oid right_type;
-} MergeOrder;
-
-typedef enum OrderType {
- MERGE_ORDER, SORTOP_ORDER
-} OrderType;
-
-typedef struct PathOrder {
- OrderType ordtype;
- union {
- Oid *sortop;
- MergeOrder *merge;
- } ord;
-} PathOrder;
-
-typedef struct Path {
- NodeTag type;
-
- Rel *parent;
- Cost path_cost;
-
- NodeTag pathtype;
-
- PathOrder p_ordering;
-
- List *keys;
- Cost outerjoincost;
- Relid joinid;
- List *locclauseinfo;
-} Path;
-
-typedef struct IndexPath {
- Path path;
- List *indexid;
- List *indexqual;
- int *indexkeys; /* to transform heap attnos into index ones */
-} IndexPath;
-
-typedef struct JoinPath {
- Path path;
- List *pathclauseinfo;
- Path *outerjoinpath;
- Path *innerjoinpath;
-} JoinPath;
-
-typedef struct MergePath {
- JoinPath jpath;
- List *path_mergeclauses;
- List *outersortkeys;
- List *innersortkeys;
-} MergePath;
-
-typedef struct HashPath {
- JoinPath jpath;
- List *path_hashclauses;
- List *outerhashkeys;
- List *innerhashkeys;
-} HashPath;
+typedef struct Rel
+{
+ NodeTag type;
+
+ /* all relations: */
+ Relid relids;
+
+ /* catalog statistics information */
+ bool indexed;
+ int pages;
+ int tuples;
+ int size;
+ int width;
+
+ /* materialization information */
+ List *targetlist;
+ List *pathlist;
+ struct Path *unorderedpath;
+ struct Path *cheapestpath;
+ bool pruneable;
+
+ /* used solely by indices: */
+ Oid *classlist; /* classes of AM operators */
+ int *indexkeys; /* keys over which we're indexing */
+ Oid relam; /* OID of the access method (in pg_am) */
+
+ Oid indproc;
+ List *indpred;
+
+ /* used by various scans and joins: */
+ Oid *ordering; /* OID of operators in sort order */
+ List *clauseinfo; /* restriction clauses */
+ List *joininfo; /* join clauses */
+ List *innerjoin;
+ List *superrels;
+} Rel;
+
+extern Var *get_expr(TargetEntry * foo);
+
+typedef struct MergeOrder
+{
+ NodeTag type;
+ Oid join_operator;
+ Oid left_operator;
+ Oid right_operator;
+ Oid left_type;
+ Oid right_type;
+} MergeOrder;
+
+typedef enum OrderType
+{
+ MERGE_ORDER, SORTOP_ORDER
+} OrderType;
+
+typedef struct PathOrder
+{
+ OrderType ordtype;
+ union
+ {
+ Oid *sortop;
+ MergeOrder *merge;
+ } ord;
+} PathOrder;
+
+typedef struct Path
+{
+ NodeTag type;
+
+ Rel *parent;
+ Cost path_cost;
+
+ NodeTag pathtype;
+
+ PathOrder p_ordering;
+
+ List *keys;
+ Cost outerjoincost;
+ Relid joinid;
+ List *locclauseinfo;
+} Path;
+
+typedef struct IndexPath
+{
+ Path path;
+ List *indexid;
+ List *indexqual;
+ int *indexkeys; /* to transform heap attnos into index
+ * ones */
+} IndexPath;
+
+typedef struct JoinPath
+{
+ Path path;
+ List *pathclauseinfo;
+ Path *outerjoinpath;
+ Path *innerjoinpath;
+} JoinPath;
+
+typedef struct MergePath
+{
+ JoinPath jpath;
+ List *path_mergeclauses;
+ List *outersortkeys;
+ List *innersortkeys;
+} MergePath;
+
+typedef struct HashPath
+{
+ JoinPath jpath;
+ List *path_hashclauses;
+ List *outerhashkeys;
+ List *innerhashkeys;
+} HashPath;
/******
* Keys
******/
-typedef struct OrderKey {
- NodeTag type;
- int attribute_number;
- Index array_index;
-} OrderKey;
+typedef struct OrderKey
+{
+ NodeTag type;
+ int attribute_number;
+ Index array_index;
+} OrderKey;
-typedef struct JoinKey {
- NodeTag type;
- Var *outer;
- Var *inner;
-} JoinKey;
+typedef struct JoinKey
+{
+ NodeTag type;
+ Var *outer;
+ Var *inner;
+} JoinKey;
/*******
* clause info
*******/
-typedef struct CInfo {
- NodeTag type;
- Expr *clause; /* should be an OP clause */
- Cost selectivity;
- bool notclause;
- List *indexids;
-
- /* mergesort only */
- MergeOrder *mergesortorder;
-
- /* hashjoin only */
- Oid hashjoinoperator;
- Relid cinfojoinid;
-} CInfo;
-
-typedef struct JoinMethod {
- NodeTag type;
- List *jmkeys;
- List *clauses;
-} JoinMethod;
-
-typedef struct HInfo {
- JoinMethod jmethod;
- Oid hashop;
-} HInfo;
-
-typedef struct MInfo {
- JoinMethod jmethod;
- MergeOrder *m_ordering;
-} MInfo;
-
-typedef struct JInfo {
- NodeTag type;
- List *otherrels;
- List *jinfoclauseinfo;
- bool mergesortable;
- bool hashjoinable;
- bool inactive;
-} JInfo;
-
-typedef struct Iter {
- NodeTag type;
- Node *iterexpr;
- Oid itertype; /* type of the iter expr (use for type
- checking) */
-} Iter;
+typedef struct CInfo
+{
+ NodeTag type;
+ Expr *clause; /* should be an OP clause */
+ Cost selectivity;
+ bool notclause;
+ List *indexids;
+
+ /* mergesort only */
+ MergeOrder *mergesortorder;
+
+ /* hashjoin only */
+ Oid hashjoinoperator;
+ Relid cinfojoinid;
+} CInfo;
+
+typedef struct JoinMethod
+{
+ NodeTag type;
+ List *jmkeys;
+ List *clauses;
+} JoinMethod;
+
+typedef struct HInfo
+{
+ JoinMethod jmethod;
+ Oid hashop;
+} HInfo;
+
+typedef struct MInfo
+{
+ JoinMethod jmethod;
+ MergeOrder *m_ordering;
+} MInfo;
+
+typedef struct JInfo
+{
+ NodeTag type;
+ List *otherrels;
+ List *jinfoclauseinfo;
+ bool mergesortable;
+ bool hashjoinable;
+ bool inactive;
+} JInfo;
+
+typedef struct Iter
+{
+ NodeTag type;
+ Node *iterexpr;
+ Oid itertype; /* type of the iter expr (use for type
+ * checking) */
+} Iter;
/*
** Stream:
-** A stream represents a root-to-leaf path in a plan tree (i.e. a tree of
+** A stream represents a root-to-leaf path in a plan tree (i.e. a tree of
** JoinPaths and Paths). The stream includes pointers to all Path nodes,
-** as well as to any clauses that reside above Path nodes. This structure
+** as well as to any clauses that reside above Path nodes. This structure
** is used to make Path nodes and clauses look similar, so that Predicate
** Migration can run.
**
-** pathptr -- pointer to the current path node
-** cinfo -- if NULL, this stream node referes to the path node.
-** Otherwise this is a pointer to the current clause.
-** clausetype -- whether cinfo is in locclauseinfo or pathclauseinfo in the
-** path node
-** upstream -- linked list pointer upwards
-** downstream -- ditto, downwards
-** groupup -- whether or not this node is in a group with the node upstream
-** groupcost -- total cost of the group that node is in
-** groupsel -- total selectivity of the group that node is in
+** pathptr -- pointer to the current path node
+** cinfo -- if NULL, this stream node referes to the path node.
+** Otherwise this is a pointer to the current clause.
+** clausetype -- whether cinfo is in locclauseinfo or pathclauseinfo in the
+** path node
+** upstream -- linked list pointer upwards
+** downstream -- ditto, downwards
+** groupup -- whether or not this node is in a group with the node upstream
+** groupcost -- total cost of the group that node is in
+** groupsel -- total selectivity of the group that node is in
*/
typedef struct Stream *StreamPtr;
-typedef struct Stream {
- NodeTag type;
- Path *pathptr;
- CInfo *cinfo;
- int *clausetype;
- struct Stream *upstream;
- struct Stream *downstream;
- bool groupup;
- Cost groupcost;
- Cost groupsel;
-} Stream;
-
-#endif /* RELATION_H */
+typedef struct Stream
+{
+ NodeTag type;
+ Path *pathptr;
+ CInfo *cinfo;
+ int *clausetype;
+ struct Stream *upstream;
+ struct Stream *downstream;
+ bool groupup;
+ Cost groupcost;
+ Cost groupsel;
+} Stream;
+
+#endif /* RELATION_H */