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

Commit9069a5f

Browse files
committed
Use a varno not chosen at random for dummy variables in the top-level
targetlist of a set-operation tree. I'm not sure that this solutionwill really stand the test of time --- perhaps we need to make a specialRTE for such vars to refer to. But this quick hack fixes Brandon CraigRhodes' complaint of 10-Feb-02 about EXCEPT in CREATE RULE, while notchanging any behavior in the better-tested cases where leftmostRTI isone anyway.
1 parent8a4fdce commit9069a5f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

‎src/backend/parser/analyze.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
*$Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.261 2003/02/09 06:56:28 tgl Exp $
9+
*$Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.262 2003/02/11 04:13:06 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -1786,6 +1786,11 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
17861786
* leftmost select and common datatypes of topmost set operation. Also
17871787
* make lists of the dummy vars and their names for use in parsing
17881788
* ORDER BY.
1789+
*
1790+
* Note: we use leftmostRTI as the varno of the dummy variables.
1791+
* It shouldn't matter too much which RT index they have, as long
1792+
* as they have one that corresponds to a real RT entry; else funny
1793+
* things may happen when the tree is mashed by rule rewriting.
17891794
*/
17901795
qry->targetList=NIL;
17911796
targetvars=NIL;
@@ -1804,7 +1809,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
18041809
-1,
18051810
colName,
18061811
false);
1807-
expr= (Expr*)makeVar(1,
1812+
expr= (Expr*)makeVar(leftmostRTI,
18081813
leftResdom->resno,
18091814
colType,
18101815
-1,
@@ -1871,7 +1876,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
18711876
NULL,
18721877
true);
18731878
jrtr=makeNode(RangeTblRef);
1874-
jrtr->rtindex=1;
1879+
jrtr->rtindex=1;/* only entry in dummy rtable */
18751880

18761881
sv_rtable=pstate->p_rtable;
18771882
pstate->p_rtable=makeList1(jrte);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp