1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* plannodes.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* definitions for query plan nodes
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
2001-01-24 20:43:33 +01:00
|
|
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2001-10-25 07:50:21 +02:00
|
|
|
* $Id: plannodes.h,v 1.51 2001/10/25 05:50:05 momjian Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef PLANNODES_H
|
1997-09-07 07:04:48 +02:00
|
|
|
#define PLANNODES_H
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1999-07-16 01:04:24 +02:00
|
|
|
#include "nodes/execnodes.h"
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Executor State types are used in the plannode structures
|
|
|
|
* so we have to include their definitions too.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* Node Type node information used by executor
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
* control nodes
|
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* Result ResultState resstate;
|
1998-07-15 16:54:39 +02:00
|
|
|
* Append AppendState appendstate;
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
* scan nodes
|
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* Scan *** CommonScanState scanstate;
|
|
|
|
* IndexScan IndexScanState indxstate;
|
2000-09-29 20:21:41 +02:00
|
|
|
* SubqueryScan SubqueryScanState subquerystate;
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* (*** nodes which inherit Scan also inherit scanstate)
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
* join nodes
|
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* NestLoop NestLoopState nlstate;
|
|
|
|
* MergeJoin MergeJoinState mergestate;
|
|
|
|
* HashJoin HashJoinState hashjoinstate;
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
* materialize nodes
|
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* Material MaterialState matstate;
|
|
|
|
* Sort SortState sortstate;
|
|
|
|
* Unique UniqueState uniquestate;
|
2000-10-05 21:11:39 +02:00
|
|
|
* SetOp SetOpState setopstate;
|
2000-10-26 23:38:24 +02:00
|
|
|
* Limit LimitState limitstate;
|
1997-09-07 07:04:48 +02:00
|
|
|
* Hash HashState hashstate;
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* node definitions
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Plan node
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct Plan
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
NodeTag type;
|
2000-01-09 01:26:47 +01:00
|
|
|
|
2000-02-15 21:49:31 +01:00
|
|
|
/* estimated execution costs for plan (see costsize.c for more info) */
|
2000-04-12 19:17:23 +02:00
|
|
|
Cost startup_cost; /* cost expended before fetching any
|
|
|
|
* tuples */
|
|
|
|
Cost total_cost; /* total cost (assuming all tuples
|
|
|
|
* fetched) */
|
2000-02-15 21:49:31 +01:00
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
/*
|
|
|
|
* planner's estimate of result size (note: LIMIT, if any, is not
|
2000-02-15 21:49:31 +01:00
|
|
|
* considered in setting plan_rows)
|
|
|
|
*/
|
|
|
|
double plan_rows; /* number of rows plan is expected to emit */
|
|
|
|
int plan_width; /* average row width in bytes */
|
2000-01-09 01:26:47 +01:00
|
|
|
|
2001-09-18 03:59:07 +02:00
|
|
|
/*
|
|
|
|
* execution state data. Having Plan point to this, rather than the
|
|
|
|
* other way round, is 100% bogus.
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
EState *state; /* at execution time, state's of
|
1997-09-07 07:04:48 +02:00
|
|
|
* individual nodes point to one EState
|
|
|
|
* for the whole top-level plan */
|
2001-09-18 03:59:07 +02:00
|
|
|
|
2001-10-25 07:50:21 +02:00
|
|
|
struct Instrumentation *instrument; /* Optional runtime stats for this
|
|
|
|
* plan node */
|
2001-09-18 03:59:07 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Common structural data for all Plan types. XXX chgParam is runtime
|
|
|
|
* data and should be in the EState, not here.
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
List *targetlist;
|
2000-09-12 23:07:18 +02:00
|
|
|
List *qual; /* implicitly-ANDed qual conditions */
|
1997-09-08 04:41:22 +02:00
|
|
|
struct Plan *lefttree;
|
|
|
|
struct Plan *righttree;
|
1998-02-26 05:46:47 +01:00
|
|
|
List *extParam; /* indices of _all_ _external_ PARAM_EXEC
|
|
|
|
* for this plan in global
|
|
|
|
* es_param_exec_vals. Params from
|
|
|
|
* setParam from initPlan-s are not
|
|
|
|
* included, but their execParam-s are
|
|
|
|
* here!!! */
|
1998-02-13 04:45:29 +01:00
|
|
|
List *locParam; /* someones from setParam-s */
|
|
|
|
List *chgParam; /* list of changed ones from the above */
|
1998-02-26 05:46:47 +01:00
|
|
|
List *initPlan; /* Init Plan nodes (un-correlated expr
|
|
|
|
* subselects) */
|
1998-02-13 04:45:29 +01:00
|
|
|
List *subPlan; /* Other SubPlan nodes */
|
1998-02-26 05:46:47 +01:00
|
|
|
|
|
|
|
/*
|
1998-02-13 04:45:29 +01:00
|
|
|
* We really need in some TopPlan node to store range table and
|
1998-02-26 05:46:47 +01:00
|
|
|
* resultRelation from Query there and get rid of Query itself from
|
|
|
|
* Executor. Some other stuff like below could be put there, too.
|
1998-02-13 04:45:29 +01:00
|
|
|
*/
|
|
|
|
int nParamExec; /* Number of them in entire query. This is
|
|
|
|
* to get Executor know about how many
|
|
|
|
* param_exec there are in query plan. */
|
1997-09-08 23:56:23 +02:00
|
|
|
} Plan;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* 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.
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#define innerPlan(node) (((Plan *)(node))->righttree)
|
|
|
|
#define outerPlan(node) (((Plan *)(node))->lefttree)
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ===============
|
|
|
|
* Top-level nodes
|
|
|
|
* ===============
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* all plan nodes "derive" from the Plan structure by having the
|
|
|
|
Plan structure as the first field. This ensures that everything works
|
|
|
|
when nodes are cast to Plan's. (node pointers are frequently cast to Plan*
|
|
|
|
when passed around generically in the executor */
|
|
|
|
|
|
|
|
|
|
|
|
/* ----------------
|
2000-11-12 01:37:02 +01:00
|
|
|
* Result node -
|
|
|
|
* If no outer plan, evaluate a variable-free targetlist.
|
|
|
|
* If outer plan, return tuples from outer plan that satisfy
|
|
|
|
* given quals (we can also do a level of projection)
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct Result
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
Plan plan;
|
|
|
|
Node *resconstantqual;
|
|
|
|
ResultState *resstate;
|
1997-09-08 23:56:23 +02:00
|
|
|
} Result;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
2000-11-12 01:37:02 +01:00
|
|
|
* Append node -
|
|
|
|
* Generate the concatenation of the results of sub-plans.
|
|
|
|
*
|
|
|
|
* Append nodes are sometimes used to switch between several result relations
|
2001-03-22 05:01:46 +01:00
|
|
|
* (when the target of an UPDATE or DELETE is an inheritance set). Such a
|
2000-11-12 01:37:02 +01:00
|
|
|
* node will have isTarget true. The Append executor is then responsible
|
|
|
|
* for updating the executor state to point at the correct target relation
|
|
|
|
* whenever it switches subplans.
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct Append
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
Plan plan;
|
1998-07-15 16:54:39 +02:00
|
|
|
List *appendplans;
|
2000-11-12 01:37:02 +01:00
|
|
|
bool isTarget;
|
1998-07-15 16:54:39 +02:00
|
|
|
AppendState *appendstate;
|
1997-09-08 22:59:27 +02:00
|
|
|
} Append;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* ==========
|
|
|
|
* Scan nodes
|
|
|
|
* ==========
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct Scan
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
Plan plan;
|
|
|
|
Index scanrelid; /* relid is index into the range table */
|
1997-09-07 07:04:48 +02:00
|
|
|
CommonScanState *scanstate;
|
1997-09-08 23:56:23 +02:00
|
|
|
} Scan;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* sequential scan node
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
typedef Scan SeqScan;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* index scan node
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct IndexScan
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
Scan scan;
|
|
|
|
List *indxid;
|
|
|
|
List *indxqual;
|
1998-11-22 11:45:09 +01:00
|
|
|
List *indxqualorig;
|
2000-04-12 19:17:23 +02:00
|
|
|
ScanDirection indxorderdir;
|
1997-09-07 07:04:48 +02:00
|
|
|
IndexScanState *indxstate;
|
1997-09-08 23:56:23 +02:00
|
|
|
} IndexScan;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1999-11-23 21:07:06 +01:00
|
|
|
/* ----------------
|
2000-04-12 19:17:23 +02:00
|
|
|
* tid scan node
|
1999-11-23 21:07:06 +01:00
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
typedef struct TidScan
|
|
|
|
{
|
2000-01-09 01:26:47 +01:00
|
|
|
Scan scan;
|
1999-11-23 21:07:06 +01:00
|
|
|
bool needRescan;
|
2000-01-09 01:26:47 +01:00
|
|
|
List *tideval;
|
|
|
|
TidScanState *tidstate;
|
1999-11-23 21:07:06 +01:00
|
|
|
} TidScan;
|
|
|
|
|
2000-09-29 20:21:41 +02:00
|
|
|
/* ----------------
|
|
|
|
* 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
|
2001-03-22 05:01:46 +01:00
|
|
|
* execution contexts. Although we are not scanning a physical relation,
|
2000-09-29 20:21:41 +02:00
|
|
|
* 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
|
2001-03-22 05:01:46 +01:00
|
|
|
* the generic lefttree field as you might expect. This is because we do
|
2000-09-29 20:21:41 +02:00
|
|
|
* 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;
|
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
/*
|
1996-08-28 03:59:28 +02:00
|
|
|
* ==========
|
|
|
|
* Join nodes
|
|
|
|
* ==========
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Join node
|
2000-09-12 23:07:18 +02:00
|
|
|
*
|
|
|
|
* 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.
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
2000-09-12 23:07:18 +02:00
|
|
|
typedef struct Join
|
|
|
|
{
|
|
|
|
Plan plan;
|
|
|
|
JoinType jointype;
|
|
|
|
List *joinqual; /* JOIN quals (in addition to plan.qual) */
|
|
|
|
} Join;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* nest loop join node
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct NestLoop
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
Join join;
|
|
|
|
NestLoopState *nlstate;
|
1997-09-08 23:56:23 +02:00
|
|
|
} NestLoop;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* merge join node
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct MergeJoin
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
Join join;
|
|
|
|
List *mergeclauses;
|
1997-09-07 07:04:48 +02:00
|
|
|
MergeJoinState *mergestate;
|
1997-09-08 23:56:23 +02:00
|
|
|
} MergeJoin;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* hash join (probe) node
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct HashJoin
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
Join join;
|
|
|
|
List *hashclauses;
|
|
|
|
Oid hashjoinop;
|
|
|
|
HashJoinState *hashjoinstate;
|
1997-09-08 23:56:23 +02:00
|
|
|
} HashJoin;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ---------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* aggregate node
|
1996-08-28 03:59:28 +02:00
|
|
|
* ---------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct Agg
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
Plan plan;
|
|
|
|
AggState *aggstate;
|
1997-09-08 22:59:27 +02:00
|
|
|
} Agg;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ---------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* group node -
|
|
|
|
* use for queries with GROUP BY specified.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* 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)
|
1996-08-28 03:59:28 +02:00
|
|
|
* ---------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct Group
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
Plan plan;
|
|
|
|
bool tuplePerGroup; /* what tuples to return (see above) */
|
|
|
|
int numCols; /* number of group columns */
|
2000-01-27 19:11:50 +01:00
|
|
|
AttrNumber *grpColIdx; /* indexes into the target list */
|
1997-09-08 04:41:22 +02:00
|
|
|
GroupState *grpstate;
|
1997-09-08 23:56:23 +02:00
|
|
|
} Group;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* materialization node
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct Material
|
|
|
|
{
|
2000-06-19 00:44:35 +02:00
|
|
|
Plan plan;
|
1997-09-08 04:41:22 +02:00
|
|
|
MaterialState *matstate;
|
1997-09-08 23:56:23 +02:00
|
|
|
} Material;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* sort node
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct Sort
|
|
|
|
{
|
2000-06-19 00:44:35 +02:00
|
|
|
Plan plan;
|
1997-09-08 04:41:22 +02:00
|
|
|
int keycount;
|
|
|
|
SortState *sortstate;
|
1997-09-08 23:56:23 +02:00
|
|
|
} Sort;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* unique node
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct Unique
|
|
|
|
{
|
2000-06-19 00:44:35 +02:00
|
|
|
Plan plan;
|
2000-04-12 19:17:23 +02:00
|
|
|
int numCols; /* number of columns to check for
|
|
|
|
* uniqueness */
|
2000-01-27 19:11:50 +01:00
|
|
|
AttrNumber *uniqColIdx; /* indexes into the target list */
|
1997-09-08 04:41:22 +02:00
|
|
|
UniqueState *uniquestate;
|
1997-09-08 23:56:23 +02:00
|
|
|
} Unique;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2000-10-05 21:11:39 +02:00
|
|
|
/* ----------------
|
|
|
|
* setop node
|
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
typedef enum SetOpCmd
|
|
|
|
{
|
2001-10-25 07:50:21 +02:00
|
|
|
SETOPCMD_INTERSECT,
|
|
|
|
SETOPCMD_INTERSECT_ALL,
|
|
|
|
SETOPCMD_EXCEPT,
|
|
|
|
SETOPCMD_EXCEPT_ALL
|
2000-10-05 21:11:39 +02:00
|
|
|
} SetOpCmd;
|
|
|
|
|
|
|
|
typedef struct SetOp
|
|
|
|
{
|
|
|
|
Plan plan;
|
|
|
|
SetOpCmd cmd; /* what to do */
|
|
|
|
int numCols; /* number of columns to check for
|
|
|
|
* duplicate-ness */
|
|
|
|
AttrNumber *dupColIdx; /* indexes into the target list */
|
|
|
|
AttrNumber flagColIdx;
|
|
|
|
SetOpState *setopstate;
|
|
|
|
} SetOp;
|
|
|
|
|
2000-10-26 23:38:24 +02:00
|
|
|
/* ----------------
|
|
|
|
* limit node
|
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
typedef struct Limit
|
|
|
|
{
|
|
|
|
Plan plan;
|
|
|
|
Node *limitOffset; /* OFFSET parameter, or NULL if none */
|
|
|
|
Node *limitCount; /* COUNT parameter, or NULL if none */
|
|
|
|
LimitState *limitstate;
|
|
|
|
} Limit;
|
|
|
|
|
1996-08-28 03:59:28 +02:00
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* hash build node
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct Hash
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
Plan plan;
|
2000-07-12 04:37:39 +02:00
|
|
|
Node *hashkey;
|
1997-09-08 04:41:22 +02:00
|
|
|
HashState *hashstate;
|
1997-09-08 23:56:23 +02:00
|
|
|
} Hash;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1999-03-23 17:51:04 +01:00
|
|
|
#ifdef NOT_USED
|
1996-08-28 03:59:28 +02:00
|
|
|
/* -------------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* Tee node information
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* leftParent : the left parent of this node
|
|
|
|
* rightParent: the right parent of this node
|
1996-08-28 03:59:28 +02:00
|
|
|
* -------------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef struct Tee
|
|
|
|
{
|
1997-09-08 04:41:22 +02:00
|
|
|
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
|
1997-09-07 07:04:48 +02:00
|
|
|
* Tee may be different than the parent
|
|
|
|
* plans */
|
2001-03-22 05:01:46 +01:00
|
|
|
} Tee;
|
1999-03-23 17:51:04 +01:00
|
|
|
#endif
|
1997-09-07 07:04:48 +02:00
|
|
|
|
1998-02-13 04:45:29 +01:00
|
|
|
/* ---------------------
|
|
|
|
* SubPlan node
|
|
|
|
* ---------------------
|
|
|
|
*/
|
|
|
|
typedef struct SubPlan
|
|
|
|
{
|
1998-02-26 05:46:47 +01:00
|
|
|
NodeTag type;
|
|
|
|
Plan *plan; /* subselect plan itself */
|
|
|
|
int plan_id; /* dummy thing because of we haven't equal
|
|
|
|
* funcs for plan nodes... actually, we
|
|
|
|
* could put *plan itself somewhere else
|
1998-02-13 04:45:29 +01:00
|
|
|
* (TopPlan node ?)... */
|
1999-11-15 04:28:07 +01:00
|
|
|
List *rtable; /* range table for subselect */
|
|
|
|
/* setParam and parParam are lists of integers (param IDs) */
|
1998-02-26 05:46:47 +01:00
|
|
|
List *setParam; /* non-correlated EXPR & EXISTS subqueries
|
1998-02-13 04:45:29 +01:00
|
|
|
* have to set some Params for paren Plan */
|
1998-02-26 05:46:47 +01:00
|
|
|
List *parParam; /* indices of corr. Vars from parent plan */
|
2000-04-12 19:17:23 +02:00
|
|
|
SubLink *sublink; /* SubLink node from parser; holds info
|
|
|
|
* about what to do with subselect's
|
|
|
|
* results */
|
|
|
|
|
1999-11-15 04:28:07 +01:00
|
|
|
/*
|
2000-04-12 19:17:23 +02:00
|
|
|
* Remaining fields are working state for executor; not used in
|
|
|
|
* planning
|
1999-11-15 04:28:07 +01:00
|
|
|
*/
|
2000-07-12 04:37:39 +02:00
|
|
|
bool needShutdown; /* TRUE = need to shutdown subplan */
|
1999-11-15 04:28:07 +01:00
|
|
|
HeapTuple curTuple; /* copy of most recent tuple from subplan */
|
1998-02-13 04:45:29 +01:00
|
|
|
} SubPlan;
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* PLANNODES_H */
|