diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-03-12 00:52:10 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-03-12 00:52:10 +0000 |
commit | 6eeb95f0f56bb5e8a0a9328aeec04c9e6de87272 (patch) | |
tree | 5f209c5926768472f9d4fd7210065c18831dbd9c /src/backend/nodes/copyfuncs.c | |
parent | 66b6bf67a197db73a880d2a4d9dab05168cde8e0 (diff) | |
download | postgresql-6eeb95f0f56bb5e8a0a9328aeec04c9e6de87272.tar.gz postgresql-6eeb95f0f56bb5e8a0a9328aeec04c9e6de87272.zip |
Restructure representation of join alias variables. An explicit JOIN
now has an RTE of its own, and references to its outputs now are Vars
referencing the JOIN RTE, rather than CASE-expressions. This allows
reverse-listing in ruleutils.c to use the correct alias easily, rather
than painfully reverse-engineering the alias namespace as it used to do.
Also, nested FULL JOINs work correctly, because the result of the inner
joins are simple Vars that the planner can cope with. This fixes a bug
reported a couple times now, notably by Tatsuo on 18-Nov-01. The alias
Vars are expanded into COALESCE expressions where needed at the very end
of planning, rather than during parsing.
Also, beginnings of support for showing plan qualifier expressions in
EXPLAIN. There are probably still cases that need work.
initdb forced due to change of stored-rule representation.
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r-- | src/backend/nodes/copyfuncs.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index ae9ac430456..97eeb35ea38 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.168 2002/03/08 04:37:16 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.169 2002/03/12 00:51:37 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -323,6 +323,7 @@ CopyJoinFields(Join *from, Join *newnode) { newnode->jointype = from->jointype; Node_Copy(from, newnode, joinqual); + newnode->joinrti = from->joinrti; /* subPlan list must point to subplans in the new subtree, not the old */ if (from->plan.subPlan != NIL) newnode->plan.subPlan = nconc(newnode->plan.subPlan, @@ -970,8 +971,7 @@ _copyJoinExpr(JoinExpr *from) Node_Copy(from, newnode, using); Node_Copy(from, newnode, quals); Node_Copy(from, newnode, alias); - Node_Copy(from, newnode, colnames); - Node_Copy(from, newnode, colvars); + newnode->rtindex = from->rtindex; return newnode; } @@ -1081,16 +1081,13 @@ _copyArrayRef(ArrayRef *from) * _copyRelOptInfo * ---------------- */ -/* - * when you change this, also make sure to fix up xfunc_copyRelOptInfo in - * planner/path/xfunc.c accordingly!!! - * -- JMH, 8/2/93 - */ static RelOptInfo * _copyRelOptInfo(RelOptInfo *from) { RelOptInfo *newnode = makeNode(RelOptInfo); + newnode->reloptkind = from->reloptkind; + newnode->relids = listCopy(from->relids); newnode->rows = from->rows; @@ -1109,6 +1106,9 @@ _copyRelOptInfo(RelOptInfo *from) newnode->tuples = from->tuples; Node_Copy(from, newnode, subplan); + newnode->joinrti = from->joinrti; + newnode->joinrteids = listCopy(from->joinrteids); + Node_Copy(from, newnode, baserestrictinfo); newnode->baserestrictcost = from->baserestrictcost; newnode->outerjoinset = listCopy(from->outerjoinset); @@ -1487,10 +1487,16 @@ _copyRangeTblEntry(RangeTblEntry *from) { RangeTblEntry *newnode = makeNode(RangeTblEntry); + newnode->rtekind = from->rtekind; if (from->relname) newnode->relname = pstrdup(from->relname); newnode->relid = from->relid; Node_Copy(from, newnode, subquery); + newnode->jointype = from->jointype; + newnode->joincoltypes = listCopy(from->joincoltypes); + newnode->joincoltypmods = listCopy(from->joincoltypmods); + newnode->joinleftcols = listCopy(from->joinleftcols); + newnode->joinrightcols = listCopy(from->joinrightcols); Node_Copy(from, newnode, alias); Node_Copy(from, newnode, eref); newnode->inh = from->inh; |