aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/list.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-10-05 19:11:39 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-10-05 19:11:39 +0000
commit05e3d0ee8666b74f11ffad16f46e372459d6e53e (patch)
treeb273892bfda60f6bad315e84aaa2e9826e226931 /src/backend/nodes/list.c
parent5292637f52c6db8a22f99177f228273cb69fc510 (diff)
downloadpostgresql-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/nodes/list.c')
-rw-r--r--src/backend/nodes/list.c26
1 files changed, 24 insertions, 2 deletions
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
@@ -237,10 +237,32 @@ 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