diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-12 00:37:02 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-12 00:37:02 +0000 |
commit | 6543d81d659f4176c6530fb09eef83deede264a0 (patch) | |
tree | c1dd2a57ee5e640214978ae72e8e7b2f624f8972 /src/backend/nodes/copyfuncs.c | |
parent | 609f9199af2411a52bb9731d8aa1f13885c439b5 (diff) | |
download | postgresql-6543d81d659f4176c6530fb09eef83deede264a0.tar.gz postgresql-6543d81d659f4176c6530fb09eef83deede264a0.zip |
Restructure handling of inheritance queries so that they work with outer
joins, and clean things up a good deal at the same time. Append plan node
no longer hacks on rangetable at runtime --- instead, all child tables are
given their own RT entries during planning. Concept of multiple target
tables pushed up into execMain, replacing bug-prone implementation within
nodeAppend. Planner now supports generating Append plans for inheritance
sets either at the top of the plan (the old way) or at the bottom. Expanding
at the bottom is appropriate for tables used as sources, since they may
appear inside an outer join; but we must still expand at the top when the
target of an UPDATE or DELETE is an inheritance set, because we actually need
a different targetlist and junkfilter for each target table in that case.
Fortunately a target table can't be inside an outer join... Bizarre mutual
recursion between union_planner and prepunion.c is gone --- in fact,
union_planner doesn't really have much to do with union queries anymore,
so I renamed it grouping_planner.
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r-- | src/backend/nodes/copyfuncs.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 93866787f37..3490ef80624 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.130 2000/11/05 22:50:19 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.131 2000/11/12 00:36:57 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -176,8 +176,7 @@ _copyAppend(Append *from) * ---------------- */ Node_Copy(from, newnode, appendplans); - newnode->inheritrelid = from->inheritrelid; - Node_Copy(from, newnode, inheritrtable); + newnode->isTarget = from->isTarget; return newnode; } @@ -1276,6 +1275,30 @@ _copyTidPath(TidPath *from) } /* ---------------- + * _copyAppendPath + * ---------------- + */ +static AppendPath * +_copyAppendPath(AppendPath *from) +{ + AppendPath *newnode = makeNode(AppendPath); + + /* ---------------- + * copy the node superclass fields + * ---------------- + */ + CopyPathFields((Path *) from, (Path *) newnode); + + /* ---------------- + * copy remainder of node + * ---------------- + */ + Node_Copy(from, newnode, subpaths); + + return newnode; +} + +/* ---------------- * CopyJoinPathFields * * This function copies the fields of the JoinPath node. It is used by @@ -1767,6 +1790,8 @@ _copyQuery(Query *from) Node_Copy(from, newnode, setOperations); + newnode->resultRelations = listCopy(from->resultRelations); + /* * We do not copy the planner internal fields: base_rel_list, * join_rel_list, equi_key_list, query_pathkeys. Not entirely clear if @@ -2677,6 +2702,9 @@ copyObject(void *from) case T_TidPath: retval = _copyTidPath(from); break; + case T_AppendPath: + retval = _copyAppendPath(from); + break; case T_NestPath: retval = _copyNestPath(from); break; |