diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-10-05 19:11:39 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-10-05 19:11:39 +0000 |
commit | 05e3d0ee8666b74f11ffad16f46e372459d6e53e (patch) | |
tree | b273892bfda60f6bad315e84aaa2e9826e226931 /src/backend/executor/nodeAppend.c | |
parent | 5292637f52c6db8a22f99177f228273cb69fc510 (diff) | |
download | postgresql-05e3d0ee8666b74f11ffad16f46e372459d6e53e.tar.gz postgresql-05e3d0ee8666b74f11ffad16f46e372459d6e53e.zip |
Reimplementation of UNION/INTERSECT/EXCEPT. INTERSECT/EXCEPT now meet the
SQL92 semantics, including support for ALL option. All three can be used
in subqueries and views. DISTINCT and ORDER BY work now in views, too.
This rewrite fixes many problems with cross-datatype UNIONs and INSERT/SELECT
where the SELECT yields different datatypes than the INSERT needs. I did
that by making UNION subqueries and SELECT in INSERT be treated like
subselects-in-FROM, thereby allowing an extra level of targetlist where the
datatype conversions can be inserted safely.
INITDB NEEDED!
Diffstat (limited to 'src/backend/executor/nodeAppend.c')
-rw-r--r-- | src/backend/executor/nodeAppend.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/backend/executor/nodeAppend.c b/src/backend/executor/nodeAppend.c index 2b1eceb15d9..6c547854b55 100644 --- a/src/backend/executor/nodeAppend.c +++ b/src/backend/executor/nodeAppend.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.35 2000/07/12 02:37:03 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.36 2000/10/05 19:11:26 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -80,11 +80,9 @@ exec_append_initialize_next(Append *node) AppendState *appendstate; TupleTableSlot *result_slot; List *rangeTable; - int whichplan; int nplans; - List *rtables; - List *rtable; + List *inheritrtable; RangeTblEntry *rtentry; /* ---------------- @@ -98,8 +96,7 @@ exec_append_initialize_next(Append *node) whichplan = appendstate->as_whichplan; nplans = appendstate->as_nplans; - rtables = node->unionrtables; - rtable = node->inheritrtable; + inheritrtable = node->inheritrtable; if (whichplan < 0) { @@ -131,19 +128,17 @@ exec_append_initialize_next(Append *node) /* ---------------- * initialize the scan * (and update the range table appropriately) - * (doesn't this leave the range table hosed for anybody upstream - * of the Append node??? - jolly ) + * + * (doesn't this leave the range table hosed for anybody upstream + * of the Append node??? - jolly ) * ---------------- */ if (node->inheritrelid > 0) { - rtentry = nth(whichplan, rtable); + rtentry = nth(whichplan, inheritrtable); Assert(rtentry != NULL); - rt_store(node->inheritrelid, rangeTable, rtentry); } - else - estate->es_range_table = nth(whichplan, rtables); if (appendstate->as_junkFilter_list) { @@ -181,7 +176,7 @@ ExecInitAppend(Append *node, EState *estate, Plan *parent) { AppendState *appendstate; int nplans; - List *rtable; + List *inheritrtable; List *appendplans; bool *initialized; int i; @@ -201,7 +196,7 @@ ExecInitAppend(Append *node, EState *estate, Plan *parent) appendplans = node->appendplans; nplans = length(appendplans); - rtable = node->inheritrtable; + inheritrtable = node->inheritrtable; initialized = (bool *) palloc(nplans * sizeof(bool)); MemSet(initialized, 0, nplans * sizeof(bool)); @@ -214,7 +209,6 @@ ExecInitAppend(Append *node, EState *estate, Plan *parent) appendstate->as_whichplan = 0; appendstate->as_nplans = nplans; appendstate->as_initialized = initialized; - appendstate->as_rtentries = rtable; node->appendstate = appendstate; @@ -250,7 +244,7 @@ ExecInitAppend(Append *node, EState *estate, Plan *parent) inherited_result_rel = true; - foreach(rtentryP, rtable) + foreach(rtentryP, inheritrtable) { RangeTblEntry *rtentry = lfirst(rtentryP); Oid reloid = rtentry->relid; @@ -522,8 +516,7 @@ ExecEndAppend(Append *node) estate->es_result_relation_info = NULL; /* - * XXX should free appendstate->as_rtentries and - * appendstate->as_junkfilter_list here + * XXX should free appendstate->as_junkfilter_list here */ } void |