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

Commit3767970

Browse files
committed
Fix oversight in recent change of representation for JOIN alias
variables: JOIN/ON should allow references to contained JOINs.Per bug report from Barry Lind.
1 parent71dc300 commit3767970

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

‎src/backend/parser/parse_clause.c

Lines changed: 14 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/parser/parse_clause.c,v 1.87 2002/03/26 19:15:57 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.88 2002/04/15 06:05:49 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -467,8 +467,8 @@ transformRangeSubselect(ParseState *pstate, RangeSubselect *r)
467467
*
468468
* Aside from the primary return value (the transformed joinlist item)
469469
* this routine also returns an integer list of the rangetable indexes
470-
* of all the base relations represented in the joinlist item. This
471-
* list is needed for checking JOIN/ON conditions in higher levels.
470+
* of all the baseand joinrelations represented in the joinlist item.
471+
*Thislist is needed for checking JOIN/ON conditions in higher levels.
472472
*/
473473
staticNode*
474474
transformFromClauseItem(ParseState*pstate,Node*n,List**containedRels)
@@ -495,7 +495,8 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
495495
{
496496
/* A newfangled join expression */
497497
JoinExpr*j= (JoinExpr*)n;
498-
List*l_containedRels,
498+
List*my_containedRels,
499+
*l_containedRels,
499500
*r_containedRels,
500501
*l_colnames,
501502
*r_colnames,
@@ -517,9 +518,10 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
517518
j->rarg=transformFromClauseItem(pstate,j->rarg,&r_containedRels);
518519

519520
/*
520-
* Generate combined list of relation indexes
521+
* Generate combined list of relation indexes for possible use
522+
* by transformJoinOnClause below.
521523
*/
522-
*containedRels=nconc(l_containedRels,r_containedRels);
524+
my_containedRels=nconc(l_containedRels,r_containedRels);
523525

524526
/*
525527
* Check for conflicting refnames in left and right subtrees. Must
@@ -705,7 +707,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
705707
elseif (j->quals)
706708
{
707709
/* User-written ON-condition; transform it */
708-
j->quals=transformJoinOnClause(pstate,j,*containedRels);
710+
j->quals=transformJoinOnClause(pstate,j,my_containedRels);
709711
}
710712
else
711713
{
@@ -768,6 +770,11 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
768770
j->rtindex=length(pstate->p_rtable);
769771
Assert(rte==rt_fetch(j->rtindex,pstate->p_rtable));
770772

773+
/*
774+
* Include join RTE in returned containedRels list
775+
*/
776+
*containedRels=lconsi(j->rtindex,my_containedRels);
777+
771778
return (Node*)j;
772779
}
773780
else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp