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

Commite69785d

Browse files
committed
Further tweaking of parsetree & plantree representation of SubLinks.
Simplify SubLink by storing just a List of operator OIDs, instead ofa list of incomplete OpExprs --- that was a bizarre and bulky choice,with no redeeming social value since we have to build new OpExprsanyway when forming the plan tree.
1 parent36ea267 commite69785d

File tree

17 files changed

+409
-248
lines changed

17 files changed

+409
-248
lines changed

‎src/backend/catalog/dependency.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/dependency.c,v 1.18 2002/12/12 15:49:21 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/dependency.c,v 1.19 2003/01/10 21:08:07 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -838,6 +838,18 @@ find_expr_references_walker(Node *node,
838838
&context->addrs);
839839
/* fall through to examine arguments */
840840
}
841+
if (IsA(node,SubLink))
842+
{
843+
SubLink*sublink= (SubLink*)node;
844+
List*opid;
845+
846+
foreach(opid,sublink->operOids)
847+
{
848+
add_object_address(OCLASS_OPERATOR, (Oid)lfirsti(opid),0,
849+
&context->addrs);
850+
}
851+
/* fall through to examine arguments */
852+
}
841853
if (is_subplan(node))
842854
{
843855
/* Extra work needed here if we ever need this case */

‎src/backend/executor/execQual.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.121 2002/12/15 16:17:45 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.122 2003/01/10 21:08:07 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2023,8 +2023,8 @@ ExecInitExpr(Expr *node, PlanState *parent)
20232023
sstate->sub_estate=NULL;
20242024
sstate->planstate=NULL;
20252025

2026-
sstate->oper= (List*)
2027-
ExecInitExpr((Expr*)subplan->oper,parent);
2026+
sstate->exprs= (List*)
2027+
ExecInitExpr((Expr*)subplan->exprs,parent);
20282028
sstate->args= (List*)
20292029
ExecInitExpr((Expr*)subplan->args,parent);
20302030

@@ -2156,7 +2156,7 @@ ExecInitExprInitPlan(SubPlan *node, PlanState *parent)
21562156
sstate->sub_estate=NULL;
21572157
sstate->planstate=NULL;
21582158

2159-
sstate->oper= (List*)ExecInitExpr((Expr*)node->oper,parent);
2159+
sstate->exprs= (List*)ExecInitExpr((Expr*)node->exprs,parent);
21602160
sstate->args= (List*)ExecInitExpr((Expr*)node->args,parent);
21612161

21622162
sstate->xprstate.expr= (Expr*)node;

‎src/backend/executor/nodeSubplan.c

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.41 2003/01/09 20:50:50 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.42 2003/01/10 21:08:08 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -110,6 +110,7 @@ ExecSubPlan(SubPlanState *node,
110110
Datumrowresult=BoolGetDatum(!useOr);
111111
boolrownull= false;
112112
intcol=1;
113+
List*plst;
113114

114115
if (subLinkType==EXISTS_SUBLINK)
115116
{
@@ -155,45 +156,19 @@ ExecSubPlan(SubPlanState *node,
155156
* For ALL, ANY, and MULTIEXPR sublinks, iterate over combining
156157
* operators for columns of tuple.
157158
*/
158-
foreach(lst,node->oper)
159+
plst=subplan->paramIds;
160+
foreach(lst,node->exprs)
159161
{
160162
ExprState*exprstate= (ExprState*)lfirst(lst);
161-
OpExpr*expr= (OpExpr*)exprstate->expr;
162-
Param*prm=lsecond(expr->args);
163+
intparamid=lfirsti(plst);
163164
ParamExecData*prmdata;
164165
Datumexpresult;
165166
boolexpnull;
166167

167168
/*
168-
* The righthand side of the expression should be either a
169-
* Param or a function call or RelabelType node taking a Param
170-
* as arg (these nodes represent run-time type coercions
171-
* inserted by the parser to get to the input type needed by
172-
* the operator). Find the Param node and insert the actual
173-
* righthand-side value into the param's econtext slot.
174-
*
175-
* XXX possible improvement: could make a list of the ParamIDs
176-
* at startup time, instead of repeating this check at each row.
169+
* Load up the Param representing this column of the sub-select.
177170
*/
178-
if (!IsA(prm,Param))
179-
{
180-
switch (nodeTag(prm))
181-
{
182-
caseT_FuncExpr:
183-
prm=lfirst(((FuncExpr*)prm)->args);
184-
break;
185-
caseT_RelabelType:
186-
prm= (Param*) (((RelabelType*)prm)->arg);
187-
break;
188-
default:
189-
/* will fail below */
190-
break;
191-
}
192-
if (!IsA(prm,Param))
193-
elog(ERROR,"ExecSubPlan: failed to find placeholder for subplan result");
194-
}
195-
Assert(prm->paramkind==PARAM_EXEC);
196-
prmdata=&(econtext->ecxt_param_exec_vals[prm->paramid]);
171+
prmdata=&(econtext->ecxt_param_exec_vals[paramid]);
197172
Assert(prmdata->execPlan==NULL);
198173
prmdata->value=heap_getattr(tup,col,tdesc,
199174
&(prmdata->isnull));
@@ -236,6 +211,8 @@ ExecSubPlan(SubPlanState *node,
236211
break;/* needn't look at any more columns */
237212
}
238213
}
214+
215+
plst=lnext(plst);
239216
col++;
240217
}
241218

@@ -312,6 +289,8 @@ ExecInitSubPlan(SubPlanState *node, EState *estate)
312289
*/
313290
node->needShutdown= false;
314291
node->curTuple=NULL;
292+
node->hashtable=NULL;
293+
node->hashnulls=NULL;
315294

316295
/*
317296
* create an EState for the subplan

‎src/backend/nodes/copyfuncs.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Portions Copyright (c) 1994, Regents of the University of California
1616
*
1717
* IDENTIFICATION
18-
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.234 2003/01/09 20:50:50 tgl Exp $
18+
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.235 2003/01/10 21:08:10 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -809,10 +809,10 @@ _copySubLink(SubLink *from)
809809
SubLink*newnode=makeNode(SubLink);
810810

811811
COPY_SCALAR_FIELD(subLinkType);
812-
COPY_SCALAR_FIELD(operIsEquals);
813812
COPY_SCALAR_FIELD(useOr);
814813
COPY_NODE_FIELD(lefthand);
815-
COPY_NODE_FIELD(oper);
814+
COPY_NODE_FIELD(operName);
815+
COPY_INTLIST_FIELD(operOids);
816816
COPY_NODE_FIELD(subselect);
817817

818818
returnnewnode;
@@ -828,10 +828,13 @@ _copySubPlan(SubPlan *from)
828828

829829
COPY_SCALAR_FIELD(subLinkType);
830830
COPY_SCALAR_FIELD(useOr);
831-
COPY_NODE_FIELD(oper);
831+
COPY_NODE_FIELD(exprs);
832+
COPY_INTLIST_FIELD(paramIds);
832833
COPY_NODE_FIELD(plan);
833834
COPY_SCALAR_FIELD(plan_id);
834835
COPY_NODE_FIELD(rtable);
836+
COPY_SCALAR_FIELD(useHashTable);
837+
COPY_SCALAR_FIELD(unknownEqFalse);
835838
COPY_INTLIST_FIELD(setParam);
836839
COPY_INTLIST_FIELD(parParam);
837840
COPY_NODE_FIELD(args);

‎src/backend/nodes/equalfuncs.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Portions Copyright (c) 1994, Regents of the University of California
1919
*
2020
* IDENTIFICATION
21-
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.178 2003/01/09 20:50:50 tgl Exp $
21+
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.179 2003/01/10 21:08:10 tgl Exp $
2222
*
2323
*-------------------------------------------------------------------------
2424
*/
@@ -287,10 +287,10 @@ static bool
287287
_equalSubLink(SubLink*a,SubLink*b)
288288
{
289289
COMPARE_SCALAR_FIELD(subLinkType);
290-
COMPARE_SCALAR_FIELD(operIsEquals);
291290
COMPARE_SCALAR_FIELD(useOr);
292291
COMPARE_NODE_FIELD(lefthand);
293-
COMPARE_NODE_FIELD(oper);
292+
COMPARE_NODE_FIELD(operName);
293+
COMPARE_INTLIST_FIELD(operOids);
294294
COMPARE_NODE_FIELD(subselect);
295295

296296
return true;
@@ -301,10 +301,13 @@ _equalSubPlan(SubPlan *a, SubPlan *b)
301301
{
302302
COMPARE_SCALAR_FIELD(subLinkType);
303303
COMPARE_SCALAR_FIELD(useOr);
304-
COMPARE_NODE_FIELD(oper);
304+
COMPARE_NODE_FIELD(exprs);
305+
COMPARE_INTLIST_FIELD(paramIds);
305306
/* should compare plans, but have to settle for comparing plan IDs */
306307
COMPARE_SCALAR_FIELD(plan_id);
307308
COMPARE_NODE_FIELD(rtable);
309+
COMPARE_SCALAR_FIELD(useHashTable);
310+
COMPARE_SCALAR_FIELD(unknownEqFalse);
308311
COMPARE_INTLIST_FIELD(setParam);
309312
COMPARE_INTLIST_FIELD(parParam);
310313
COMPARE_NODE_FIELD(args);

‎src/backend/nodes/outfuncs.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.191 2003/01/09 20:50:50 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.192 2003/01/10 21:08:11 tgl Exp $
1212
*
1313
* NOTES
1414
* Every node type that can appear in stored rules' parsetrees *must*
@@ -658,10 +658,10 @@ _outSubLink(StringInfo str, SubLink *node)
658658
WRITE_NODE_TYPE("SUBLINK");
659659

660660
WRITE_ENUM_FIELD(subLinkType,SubLinkType);
661-
WRITE_BOOL_FIELD(operIsEquals);
662661
WRITE_BOOL_FIELD(useOr);
663662
WRITE_NODE_FIELD(lefthand);
664-
WRITE_NODE_FIELD(oper);
663+
WRITE_NODE_FIELD(operName);
664+
WRITE_INTLIST_FIELD(operOids);
665665
WRITE_NODE_FIELD(subselect);
666666
}
667667

@@ -672,10 +672,13 @@ _outSubPlan(StringInfo str, SubPlan *node)
672672

673673
WRITE_ENUM_FIELD(subLinkType,SubLinkType);
674674
WRITE_BOOL_FIELD(useOr);
675-
WRITE_NODE_FIELD(oper);
675+
WRITE_NODE_FIELD(exprs);
676+
WRITE_INTLIST_FIELD(paramIds);
676677
WRITE_NODE_FIELD(plan);
677678
WRITE_INT_FIELD(plan_id);
678679
WRITE_NODE_FIELD(rtable);
680+
WRITE_BOOL_FIELD(useHashTable);
681+
WRITE_BOOL_FIELD(unknownEqFalse);
679682
WRITE_INTLIST_FIELD(setParam);
680683
WRITE_INTLIST_FIELD(parParam);
681684
WRITE_NODE_FIELD(args);

‎src/backend/nodes/readfuncs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.145 2003/01/09 20:50:51 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.146 2003/01/10 21:08:11 tgl Exp $
1212
*
1313
* NOTES
1414
* Path and Plan nodes do not have any readfuncs support, because we
@@ -531,10 +531,10 @@ _readSubLink(void)
531531
READ_LOCALS(SubLink);
532532

533533
READ_ENUM_FIELD(subLinkType,SubLinkType);
534-
READ_BOOL_FIELD(operIsEquals);
535534
READ_BOOL_FIELD(useOr);
536535
READ_NODE_FIELD(lefthand);
537-
READ_NODE_FIELD(oper);
536+
READ_NODE_FIELD(operName);
537+
READ_INTLIST_FIELD(operOids);
538538
READ_NODE_FIELD(subselect);
539539

540540
READ_DONE();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp