From 05e3d0ee8666b74f11ffad16f46e372459d6e53e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 5 Oct 2000 19:11:39 +0000 Subject: 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! --- src/backend/nodes/list.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/backend/nodes/list.c') diff --git a/src/backend/nodes/list.c b/src/backend/nodes/list.c index 358e6a7eb6f..66674b5c364 100644 --- a/src/backend/nodes/list.c +++ b/src/backend/nodes/list.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.34 2000/09/29 18:21:29 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.35 2000/10/05 19:11:27 tgl Exp $ * * NOTES * XXX a few of the following functions are duplicated to handle @@ -236,11 +236,33 @@ freeList(List *list) } } +/* + * equali + * compares two lists of integers + */ +bool +equali(List *list1, List *list2) +{ + List *l; + + foreach(l, list1) + { + if (list2 == NIL) + return false; + if (lfirsti(l) != lfirsti(list2)) + return false; + list2 = lnext(list2); + } + if (list2 != NIL) + return false; + return true; +} + /* * sameseti * * Returns t if two integer lists contain the same elements - * (but unlike equal(), they need not be in the same order) + * (but unlike equali(), they need not be in the same order) * * Caution: this routine could be fooled if list1 contains * duplicate elements. It is intended to be used on lists -- cgit v1.2.3