summaryrefslogtreecommitdiff
path: root/src/backend/parser/analyze.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-02-11 04:13:39 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-02-11 04:13:39 +0000
commit02c614dc85ae085272c841977ec125bcea0b0306 (patch)
tree17bf4183c2a735a4c17a657c9a1fba9599904685 /src/backend/parser/analyze.c
parentd3038e6e2cc61e999caf133c404b94137aa0df1d (diff)
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 solution will really stand the test of time --- perhaps we need to make a special RTE for such vars to refer to. But this quick hack fixes Brandon Craig Rhodes' complaint of 10-Feb-02 about EXCEPT in CREATE RULE, while not changing any behavior in the better-tested cases where leftmostRTI is one anyway.
Diffstat (limited to 'src/backend/parser/analyze.c')
-rw-r--r--src/backend/parser/analyze.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 30c8e8f15b9..14602869f3f 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.253 2002/10/21 22:06:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.253.2.1 2003/02/11 04:13:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1796,6 +1796,11 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
* leftmost select and common datatypes of topmost set operation. Also
* make lists of the dummy vars and their names for use in parsing
* ORDER BY.
+ *
+ * Note: we use leftmostRTI as the varno of the dummy variables.
+ * It shouldn't matter too much which RT index they have, as long
+ * as they have one that corresponds to a real RT entry; else funny
+ * things may happen when the tree is mashed by rule rewriting.
*/
qry->targetList = NIL;
targetvars = NIL;
@@ -1814,7 +1819,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
-1,
colName,
false);
- expr = (Node *) makeVar(1,
+ expr = (Node *) makeVar(leftmostRTI,
leftResdom->resno,
colType,
-1,