* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: plannodes.h,v 1.39 2000/04/12 17:16:40 momjian Exp $
+ * $Id: plannodes.h,v 1.43 2000/09/29 18:21:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
*
* Scan *** CommonScanState scanstate;
* IndexScan IndexScanState indxstate;
+ * SubqueryScan SubqueryScanState subquerystate;
*
* (*** nodes which inherit Scan also inherit scanstate)
*
* individual nodes point to one EState
* for the whole top-level plan */
List *targetlist;
- List *qual; /* Node* or List* ?? */
+ List *qual; /* implicitly-ANDed qual conditions */
struct Plan *lefttree;
struct Plan *righttree;
List *extParam; /* indices of _all_ _external_ PARAM_EXEC
TidScanState *tidstate;
} TidScan;
+/* ----------------
+ * subquery scan node
+ *
+ * SubqueryScan is for scanning the output of a sub-query in the range table.
+ * We need a special plan node above the sub-query's plan as a place to switch
+ * execution contexts. Although we are not scanning a physical relation,
+ * we make this a descendant of Scan anyway for code-sharing purposes.
+ *
+ * Note: we store the sub-plan in the type-specific subplan field, not in
+ * the generic lefttree field as you might expect. This is because we do
+ * not want plan-tree-traversal routines to recurse into the subplan without
+ * knowing that they are changing Query contexts.
+ * ----------------
+ */
+typedef struct SubqueryScan
+{
+ Scan scan;
+ Plan *subplan;
+} SubqueryScan;
+
/*
* ==========
* Join nodes
/* ----------------
* Join node
+ *
+ * jointype: rule for joining tuples from left and right subtrees
+ * joinqual: qual conditions that came from JOIN/ON or JOIN/USING
+ * (plan.qual contains conditions that came from WHERE)
+ *
+ * When jointype is INNER, joinqual and plan.qual are semantically
+ * interchangeable. For OUTER jointypes, the two are *not* interchangeable;
+ * only joinqual is used to determine whether a match has been found for
+ * the purpose of deciding whether to generate null-extended tuples.
+ * (But plan.qual is still applied before actually returning a tuple.)
+ * For an outer join, only joinquals are allowed to be used as the merge
+ * or hash condition of a merge or hash join.
* ----------------
*/
-typedef Plan Join;
+typedef struct Join
+{
+ Plan plan;
+ JoinType jointype;
+ List *joinqual; /* JOIN quals (in addition to plan.qual) */
+} Join;
/* ----------------
* nest loop join node
List *hashclauses;
Oid hashjoinop;
HashJoinState *hashjoinstate;
- bool hashdone;
} HashJoin;
/* ---------------
GroupState *grpstate;
} Group;
-/*
- * ==========
- * Noname nodes
- * ==========
- */
-typedef struct Noname
-{
- Plan plan;
- Oid nonameid;
- int keycount;
-} Noname;
-
/* ----------------
* materialization node
* ----------------
*/
typedef struct Material
{
- Plan plan; /* noname node flattened out */
- Oid nonameid;
- int keycount;
+ Plan plan;
MaterialState *matstate;
} Material;
*/
typedef struct Sort
{
- Plan plan; /* noname node flattened out */
- Oid nonameid;
+ Plan plan;
int keycount;
SortState *sortstate;
} Sort;
*/
typedef struct Unique
{
- Plan plan; /* noname node flattened out */
- Oid nonameid;
- int keycount;
+ Plan plan;
int numCols; /* number of columns to check for
* uniqueness */
AttrNumber *uniqColIdx; /* indexes into the target list */
typedef struct Hash
{
Plan plan;
- Var *hashkey;
+ Node *hashkey;
HashState *hashstate;
} Hash;
* Remaining fields are working state for executor; not used in
* planning
*/
- bool shutdown; /* TRUE = need to shutdown plan */
+ bool needShutdown; /* TRUE = need to shutdown subplan */
HeapTuple curTuple; /* copy of most recent tuple from subplan */
} SubPlan;