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

Commite2004df

Browse files
committed
Suppress pull-up of subqueries that are in the nullable side of an outer
join. This is needed to avoid improper evaluation of expressions thatshould be nulled out, as in Victor Wagner's bug report of 4/27/01.Pretty ugly solution, but no time to do anything better for 7.1.1.
1 parent60ba30d commite2004df

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

‎src/backend/optimizer/plan/planner.c

Lines changed: 36 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/optimizer/plan/planner.c,v 1.104 2001/04/18 20:42:55 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.105 2001/04/30 19:24:47 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -363,8 +363,41 @@ pull_up_subqueries(Query *parse, Node *jtnode)
363363
{
364364
JoinExpr*j= (JoinExpr*)jtnode;
365365

366-
j->larg=pull_up_subqueries(parse,j->larg);
367-
j->rarg=pull_up_subqueries(parse,j->rarg);
366+
/*
367+
* At the moment, we can't pull up subqueries that are inside the
368+
* nullable side of an outer join, because substituting their target
369+
* list entries for upper Var references wouldn't do the right thing
370+
* (the entries wouldn't go to NULL when they're supposed to).
371+
* Suppressing the pullup is an ugly, performance-losing hack, but
372+
* I see no alternative for now. Find a better way to handle this
373+
* when we redesign query trees --- tgl 4/30/01.
374+
*/
375+
switch (j->jointype)
376+
{
377+
caseJOIN_INNER:
378+
j->larg=pull_up_subqueries(parse,j->larg);
379+
j->rarg=pull_up_subqueries(parse,j->rarg);
380+
break;
381+
caseJOIN_LEFT:
382+
j->larg=pull_up_subqueries(parse,j->larg);
383+
break;
384+
caseJOIN_FULL:
385+
break;
386+
caseJOIN_RIGHT:
387+
j->rarg=pull_up_subqueries(parse,j->rarg);
388+
break;
389+
caseJOIN_UNION:
390+
/*
391+
* This is where we fail if upper levels of planner
392+
* haven't rewritten UNION JOIN as an Append ...
393+
*/
394+
elog(ERROR,"UNION JOIN is not implemented yet");
395+
break;
396+
default:
397+
elog(ERROR,"pull_up_subqueries: unexpected join type %d",
398+
j->jointype);
399+
break;
400+
}
368401
}
369402
else
370403
elog(ERROR,"pull_up_subqueries: unexpected node type %d",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp