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

Commit9323cb0

Browse files
committed
Department of second thoughts: probably shouldn't use nth() to get the
appropriate targetlist entry out of the subquery. Use an explicit searchlike we do everywhere else.
1 parented11ccf commit9323cb0

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

‎src/backend/optimizer/path/allpaths.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.100 2003/03/2201:49:38 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.101 2003/03/2217:11:25 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -638,7 +638,7 @@ qual_is_pushdown_safe(Query *subquery, Index rti, Node *qual)
638638
{
639639
boolsafe= true;
640640
List*vars;
641-
List*l;
641+
List*vl;
642642
Bitmapset*tested=NULL;
643643

644644
/* Refuse subselects (point 1) */
@@ -650,10 +650,11 @@ qual_is_pushdown_safe(Query *subquery, Index rti, Node *qual)
650650
* all such Vars must refer to subselect output columns.
651651
*/
652652
vars=pull_var_clause(qual, false);
653-
foreach(l,vars)
653+
foreach(vl,vars)
654654
{
655-
Var*var= (Var*)lfirst(l);
656-
TargetEntry*tle;
655+
Var*var= (Var*)lfirst(vl);
656+
List*tl;
657+
TargetEntry*tle=NULL;
657658

658659
Assert(var->varno==rti);
659660
/*
@@ -665,8 +666,13 @@ qual_is_pushdown_safe(Query *subquery, Index rti, Node *qual)
665666
continue;
666667
tested=bms_add_member(tested,var->varattno);
667668

668-
tle= (TargetEntry*)nth(var->varattno-1,subquery->targetList);
669-
Assert(tle->resdom->resno==var->varattno);
669+
foreach(tl,subquery->targetList)
670+
{
671+
tle= (TargetEntry*)lfirst(tl);
672+
if (tle->resdom->resno==var->varattno)
673+
break;
674+
}
675+
Assert(tl!=NIL);
670676
Assert(!tle->resdom->resjunk);
671677

672678
/* If subquery uses DISTINCT or DISTINCT ON, check point 2 */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp