Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6fcf2d7

Browse files
committed
New SubPlan node for subselects.
New PARAM_EXEC type.
1 parenteab1471 commit6fcf2d7

File tree

5 files changed

+83
-30
lines changed

5 files changed

+83
-30
lines changed

‎src/include/nodes/execnodes.h

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: execnodes.h,v 1.12 1997/09/08 21:52:40 momjian Exp $
9+
* $Id: execnodes.h,v 1.13 1998/02/13 03:45:22 vadim Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -80,16 +80,17 @@ typedef struct RelationInfo
8080
*/
8181
typedefstructExprContext
8282
{
83-
NodeTagtype;
84-
TupleTableSlot*ecxt_scantuple;
85-
TupleTableSlot*ecxt_innertuple;
86-
TupleTableSlot*ecxt_outertuple;
87-
Relationecxt_relation;
88-
Indexecxt_relid;
89-
ParamListInfoecxt_param_list_info;
90-
List*ecxt_range_table;
91-
Datum*ecxt_values;/* precomputed values for aggreg */
92-
char*ecxt_nulls;/* null flags for aggreg values */
83+
NodeTagtype;
84+
TupleTableSlot*ecxt_scantuple;
85+
TupleTableSlot*ecxt_innertuple;
86+
TupleTableSlot*ecxt_outertuple;
87+
Relationecxt_relation;
88+
Indexecxt_relid;
89+
ParamListInfoecxt_param_list_info;
90+
ParamExecData*ecxt_param_exec_vals;/* this is for subselects */
91+
List*ecxt_range_table;
92+
Datum*ecxt_values;/* precomputed values for aggreg */
93+
char*ecxt_nulls;/* null flags for aggreg values */
9394
}ExprContext;
9495

9596
/* ----------------
@@ -193,18 +194,19 @@ typedef struct JunkFilter
193194
*/
194195
typedefstructEState
195196
{
196-
NodeTagtype;
197-
ScanDirectiones_direction;
198-
List*es_range_table;
199-
RelationInfo*es_result_relation_info;
200-
Relationes_into_relation_descriptor;
201-
ParamListInfoes_param_list_info;
202-
intes_BaseId;
203-
TupleTablees_tupleTable;
204-
JunkFilter*es_junkFilter;
205-
int*es_refcount;
206-
uint32es_processed;/* # of tuples processed */
207-
Oides_lastoid;/* last oid processed (by INSERT) */
197+
NodeTagtype;
198+
ScanDirectiones_direction;
199+
List*es_range_table;
200+
RelationInfo*es_result_relation_info;
201+
Relationes_into_relation_descriptor;
202+
ParamListInfoes_param_list_info;
203+
ParamExecData*es_param_exec_vals;/* this is for subselects */
204+
intes_BaseId;
205+
TupleTablees_tupleTable;
206+
JunkFilter*es_junkFilter;
207+
int*es_refcount;
208+
uint32es_processed;/* # of tuples processed */
209+
Oides_lastoid;/* last oid processed (by INSERT) */
208210
}EState;
209211

210212
/* ----------------
@@ -292,7 +294,8 @@ typedef struct CommonState
292294
typedefstructResultState
293295
{
294296
CommonStatecstate;/* its first field is NodeTag */
295-
intrs_done;
297+
boolrs_done;
298+
boolrs_checkqual;
296299
}ResultState;
297300

298301
/* ----------------

‎src/include/nodes/nodes.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: nodes.h,v 1.23 1998/01/17 04:53:38 momjian Exp $
9+
* $Id: nodes.h,v 1.24 1998/02/13 03:45:23 vadim Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -47,6 +47,7 @@ typedef enum NodeTag
4747
T_Choose,
4848
T_Tee,
4949
T_Group,
50+
T_SubPlan,
5051

5152
/*---------------------
5253
* TAGS FOR PRIMITIVE NODES (primnodes.h)

‎src/include/nodes/params.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: params.h,v 1.6 1997/09/08 21:52:48 momjian Exp $
9+
* $Id: params.h,v 1.7 1998/02/13 03:45:24 vadim Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -36,12 +36,16 @@
3636
*
3737
* PARAM_OLD:Same as PARAM_NEW, but in this case we refer to
3838
*the "OLD" tuple.
39+
*
40+
* PARAM_EXEC:Evaluated by executor. Used for subselect...
41+
*
3942
*/
4043

4144
#definePARAM_NAMED11
4245
#definePARAM_NUM12
4346
#definePARAM_NEW13
4447
#definePARAM_OLD14
48+
#definePARAM_EXEC15
4549
#definePARAM_INVALID100
4650

4751

@@ -87,4 +91,11 @@ typedef struct ParamListInfoData
8791

8892
typedefParamListInfoData*ParamListInfo;
8993

94+
typedefstructParamExecData
95+
{
96+
void*execPlan;/* plan must be executed to get param value */
97+
Datumvalue;
98+
boolisnull;
99+
}ParamExecData;
100+
90101
#endif/* PARAMS_H */

‎src/include/nodes/plannodes.h

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: plannodes.h,v 1.13 1998/01/15 19:00:13 momjian Exp $
9+
* $Id: plannodes.h,v 1.14 1998/02/13 03:45:25 vadim Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -74,6 +74,24 @@ typedef struct Plan
7474
List*qual;/* Node* or List* ?? */
7575
structPlan*lefttree;
7676
structPlan*righttree;
77+
List*extParam;/* indices of _all_ _external_ PARAM_EXEC for
78+
* this plan in global es_param_exec_vals.
79+
* Params from setParam from initPlan-s
80+
* are not included, but their execParam-s
81+
* are here!!! */
82+
List*locParam;/* someones from setParam-s */
83+
List*chgParam;/* list of changed ones from the above */
84+
List*initPlan;/* Init Plan nodes (un-correlated expr subselects) */
85+
List*subPlan;/* Other SubPlan nodes */
86+
87+
/*
88+
* We really need in some TopPlan node to store range table and
89+
* resultRelation from Query there and get rid of Query itself
90+
* from Executor. Some other stuff like below could be put there, too.
91+
*/
92+
intnParamExec;/* Number of them in entire query. This is
93+
* to get Executor know about how many
94+
* param_exec there are in query plan. */
7795
}Plan;
7896

7997
/* ----------------
@@ -335,4 +353,24 @@ typedef struct Tee
335353
* plans */
336354
}Tee;
337355

356+
/* ---------------------
357+
*SubPlan node
358+
* ---------------------
359+
*/
360+
typedefstructSubPlan
361+
{
362+
NodeTagtype;
363+
Plan*plan;/* subselect plan itself */
364+
intplan_id;/* dummy thing because of we haven't
365+
* equal funcs for plan nodes... actually,
366+
* we could put *plan itself somewhere else
367+
* (TopPlan node ?)... */
368+
List*rtable;/* range table */
369+
List*setParam;/* non-correlated EXPR & EXISTS subqueries
370+
* have to set some Params for paren Plan */
371+
List*parParam;/* indices of corr. Vars from parent plan */
372+
SubLink*sublink;/* SubLink node for subselects in WHERE and HAVING */
373+
boolshutdown;/* shutdown plan if TRUE */
374+
}SubPlan;
375+
338376
#endif/* PLANNODES_H */

‎src/include/nodes/primnodes.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: primnodes.h,v 1.18 1998/02/10 16:04:27 momjian Exp $
9+
* $Id: primnodes.h,v 1.19 1998/02/13 03:45:29 vadim Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -86,15 +86,15 @@ typedef struct Fjoin
8686
*/
8787
typedefenumOpType
8888
{
89-
OP_EXPR,FUNC_EXPR,OR_EXPR,AND_EXPR,NOT_EXPR
89+
OP_EXPR,FUNC_EXPR,OR_EXPR,AND_EXPR,NOT_EXPR,SUBPLAN_EXPR
9090
}OpType;
9191

9292
typedefstructExpr
9393
{
9494
NodeTagtype;
9595
OidtypeOid;/* oid of the type of this expr */
9696
OpTypeopType;/* type of the op */
97-
Node*oper;/* could be Oper or Func */
97+
Node*oper;/* could be Oper or Funcor SubPlan*/
9898
List*args;/* list of argument nodes */
9999
}Expr;
100100

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp