Changeset: eeed89c91e4f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=eeed89c91e4f
Modified Files:
        sql/server/rel_unnest.c
        sql/test/subquery/Tests/subquery3.sql
        sql/test/subquery/Tests/subquery3.stable.err
        sql/test/subquery/Tests/subquery3.stable.out
Branch: linear-hashing
Log Message:

Allow table returning relations to bypass assertion check


diffs (93 lines):

diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -1200,7 +1200,7 @@ push_up_table(mvc *sql, sql_rel *rel, li
                        if (tf->l) {
                                sql_rel *l = tf->l;
 
-                               assert(!l->l);
+                               assert(tf->flag == TABLE_FROM_RELATION || 
!l->l); /* TODO table functions implementation */
                                l->l = rel_dup(d);
                        } else {
                                tf->l = rel_dup(d);
diff --git a/sql/test/subquery/Tests/subquery3.sql 
b/sql/test/subquery/Tests/subquery3.sql
--- a/sql/test/subquery/Tests/subquery3.sql
+++ b/sql/test/subquery/Tests/subquery3.sql
@@ -427,6 +427,30 @@ SELECT
        (SELECT outt FROM evilfunction((SELECT t2.col1 FROM another_T t2))) 
 FROM another_T; --error, more than one row returned by a subquery used as an 
expression
 
+/*SELECT
+       (SELECT outt FROM evilfunction((SELECT MIN(col1)))) 
+FROM another_T;
+       -- 1
+       -- 1
+       -- 1
+       -- 1
+
+SELECT
+       (SELECT outt FROM evilfunction((SELECT MAX(col1) FROM 
tbl_ProductSales))) 
+FROM another_T; 
+       -- 1111
+       -- 1111
+       -- 1111
+       -- 1111*/
+
+SELECT
+       (SELECT outt FROM evilfunction((SELECT MIN(t2.col1) FROM another_T 
t2))) 
+FROM another_T;
+       -- 1
+       -- 1
+       -- 1
+       -- 1
+
 PREPARE SELECT
        (SELECT ? FROM evilfunction((SELECT 1))) 
 FROM another_T;
diff --git a/sql/test/subquery/Tests/subquery3.stable.err 
b/sql/test/subquery/Tests/subquery3.stable.err
--- a/sql/test/subquery/Tests/subquery3.stable.err
+++ b/sql/test/subquery/Tests/subquery3.stable.err
@@ -218,7 +218,19 @@ QUERY = SELECT
         FROM another_T; --error, col0 doesn't exist
 ERROR = !SELECT: identifier 'col0' unknown
 CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-135307/.s.monetdb.36213
+MAPI  = (monetdb) /var/tmp/mtest-139585/.s.monetdb.31629
+QUERY = SELECT
+               (SELECT outt FROM evilfunction((SELECT col1))) 
+        FROM another_T; --error, more than one row returned by a subquery used 
as an expression
+ERROR = !zero_or_one: cardinality violation, scalar expression expected
+CODE  = M0M29
+MAPI  = (monetdb) /var/tmp/mtest-139585/.s.monetdb.31629
+QUERY = SELECT
+               (SELECT outt FROM evilfunction((SELECT col1 FROM 
tbl_ProductSales))) 
+        FROM another_T; --error, more than one row returned by a subquery used 
as an expression
+ERROR = !zero_or_one: cardinality violation, scalar expression expected
+CODE  = M0M29
+MAPI  = (monetdb) /var/tmp/mtest-139585/.s.monetdb.31629
 QUERY = SELECT
                (SELECT outt FROM evilfunction((SELECT t2.col1 FROM another_T 
t2))) 
         FROM another_T; --error, more than one row returned by a subquery used 
as an expression
diff --git a/sql/test/subquery/Tests/subquery3.stable.out 
b/sql/test/subquery/Tests/subquery3.stable.out
--- a/sql/test/subquery/Tests/subquery3.stable.out
+++ b/sql/test/subquery/Tests/subquery3.stable.out
@@ -427,6 +427,19 @@ stdout of test 'subquery3` in directory 
 % col1 # name
 % int # type
 % 1 # length
+#CREATE FUNCTION evilfunction(input INT) RETURNS TABLE (outt INT) BEGIN RETURN 
TABLE(SELECT input); END;
+#SELECT
+#      (SELECT outt FROM evilfunction((SELECT MIN(t2.col1) FROM another_T 
t2))) 
+#FROM another_T;
+% .%4 # table_name
+% %4 # name
+% int # type
+% 1 # length
+[ 1    ]
+[ 1    ]
+[ 1    ]
+[ 1    ]
+#DROP FUNCTION evilfunction(INT);
 #DROP TABLE tbl_ProductSales;
 #DROP TABLE another_T;
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to