Changeset: 7412442674ae for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7412442674ae Modified Files: sql/test/miscellaneous/Tests/simple_selects.stable.err sql/test/miscellaneous/Tests/simple_selects.stable.out sql/test/subquery/Tests/subquery4.sql sql/test/subquery/Tests/subquery4.stable.err sql/test/subquery/Tests/subquery4.stable.out Branch: pushdown Log Message:
merged diffs (225 lines): diff --git a/sql/test/miscellaneous/Tests/simple_selects.stable.err b/sql/test/miscellaneous/Tests/simple_selects.stable.err --- a/sql/test/miscellaneous/Tests/simple_selects.stable.err +++ b/sql/test/miscellaneous/Tests/simple_selects.stable.err @@ -69,7 +69,27 @@ MAPI = (monetdb) /var/tmp/mtest-389745/ QUERY = select cast(z as interval month) from x; --error, cannot cast ERROR = !types timestamp(7,0) and month_interval(3,0) are not equal for column 'z' CODE = 42000 -MAPI = (monetdb) /var/tmp/mtest-389745/.s.monetdb.32344 +MAPI = (monetdb) /var/tmp/mtest-193867/.s.monetdb.35256 +QUERY = select cast(w as interval second) from x; +ERROR = !types real(24,0) and sec_interval(13,0) are not equal for column 'w' +CODE = 42000 +MAPI = (monetdb) /var/tmp/mtest-193867/.s.monetdb.35256 +QUERY = select cast(w as interval month) from x; +ERROR = !types real(24,0) and month_interval(3,0) are not equal for column 'w' +CODE = 42000 +MAPI = (monetdb) /var/tmp/mtest-193867/.s.monetdb.35256 +QUERY = select cast(a as interval second) from x; +ERROR = !types double(53,0) and sec_interval(13,0) are not equal for column 'a' +CODE = 42000 +MAPI = (monetdb) /var/tmp/mtest-193867/.s.monetdb.35256 +QUERY = select cast(a as interval month) from x; +ERROR = !types double(53,0) and month_interval(3,0) are not equal for column 'a' +CODE = 42000 +MAPI = (monetdb) /var/tmp/mtest-193867/.s.monetdb.35256 +QUERY = select cast(b as interval month) from x; +ERROR = !types decimal(18,3) and month_interval(3,0) are not equal for column 'b' +CODE = 42000 +MAPI = (monetdb) /var/tmp/mtest-193867/.s.monetdb.35256 QUERY = select "idontexist"."idontexist"(); --error, it doesn't exist ERROR = !SELECT: no such schema 'idontexist' CODE = 3F000 diff --git a/sql/test/miscellaneous/Tests/simple_selects.stable.out b/sql/test/miscellaneous/Tests/simple_selects.stable.out --- a/sql/test/miscellaneous/Tests/simple_selects.stable.out +++ b/sql/test/miscellaneous/Tests/simple_selects.stable.out @@ -158,6 +158,42 @@ stdout of test 'simple_selects` in direc % time # type % 8 # length [ 00:00:01 ] +#select cast(x as real) from x; +% sys.x # table_name +% x # name +% real # type +% 15 # length +[ 1 ] +#select cast(x as double) from x; +% sys.x # table_name +% x # name +% double # type +% 24 # length +[ 1 ] +#select cast(x as decimal) from x; +% sys.x # table_name +% x # name +% decimal # type +% 20 # length +[ 1.000 ] +#select cast(y as real) from x; +% sys.x # table_name +% y # name +% real # type +% 15 # length +[ 1 ] +#select cast(y as double) from x; +% sys.x # table_name +% y # name +% double # type +% 24 # length +[ 1 ] +#select cast(y as decimal) from x; +% sys.x # table_name +% y # name +% decimal # type +% 20 # length +[ 1.000 ] #insert into x values (null, null); [ 1 ] #select cast(x as time) from x; @@ -167,10 +203,58 @@ stdout of test 'simple_selects` in direc % 8 # length [ 00:00:01 ] [ NULL ] +#select cast(x as real) from x; +% sys.x # table_name +% x # name +% real # type +% 15 # length +[ 1 ] +[ NULL ] +#select cast(x as double) from x; +% sys.x # table_name +% x # name +% double # type +% 24 # length +[ 1 ] +[ NULL ] +#select cast(x as decimal) from x; +% sys.x # table_name +% x # name +% decimal # type +% 20 # length +[ 1.000 ] +[ NULL ] +#select cast(y as real) from x; +% sys.x # table_name +% y # name +% real # type +% 15 # length +[ 1 ] +[ NULL ] +#select cast(y as double) from x; +% sys.x # table_name +% y # name +% double # type +% 24 # length +[ 1 ] +[ NULL ] +#select cast(y as decimal) from x; +% sys.x # table_name +% y # name +% decimal # type +% 20 # length +[ 1.000 ] +[ NULL ] #drop table x; #create table x (x time, y date, z timestamp); #insert into x values (null, null, null); [ 1 ] +#select cast(b as interval second) from x; +% sys.x # table_name +% b # name +% sec_interval # type +% 5 # length +[ NULL ] #drop table x; #select difference('foobar', 'oobar'), difference(NULL, 'oobar'), difference('foobar', NULL), difference(NULL, NULL), # editdistance('foobar', 'oobar'), editdistance(NULL, 'oobar'), editdistance('foobar', NULL), editdistance(NULL, NULL), diff --git a/sql/test/subquery/Tests/subquery4.sql b/sql/test/subquery/Tests/subquery4.sql --- a/sql/test/subquery/Tests/subquery4.sql +++ b/sql/test/subquery/Tests/subquery4.sql @@ -120,6 +120,15 @@ SELECT (SELECT NTILE(i1.i) OVER (PARTITI -- 1 -- NULL +/* On joined tables, the correlation happens in the outer query */ +SELECT CAST((SELECT SUM(i2.i + i1.i)) AS BIGINT) FROM integers i1, integers i2; + +SELECT CAST((SELECT SUM(i2.i + i1.i)) AS BIGINT) FROM integers i1 INNER JOIN integers i2 ON i1.i = i2.i; + +SELECT i1.i, i2.i FROM integers i1, integers i2 WHERE (SELECT SUM(i2.i + i1.i)) > 0; + +SELECT i1.i, i2.i FROM integers i1, integers i2 HAVING (SELECT SUM(i2.i + i1.i)) > 0; --error, cannot use non GROUP BY column 'i1.i' in query results without an aggregate function + UPDATE another_T SET col1 = MIN(col1); --error, aggregates not allowed in update set clause UPDATE another_T SET col2 = 1 WHERE col1 = SUM(col2); --error, aggregates not allowed in update set clause UPDATE another_T SET col3 = (SELECT MAX(col5)); --error, aggregates not allowed in update set clause diff --git a/sql/test/subquery/Tests/subquery4.stable.err b/sql/test/subquery/Tests/subquery4.stable.err --- a/sql/test/subquery/Tests/subquery4.stable.err +++ b/sql/test/subquery/Tests/subquery4.stable.err @@ -80,7 +80,11 @@ MAPI = (monetdb) /var/tmp/mtest-675878/ QUERY = SELECT i FROM integers WHERE (SELECT true, false UNION ALL SELECT false, true); --error, subquery must return only one column ERROR = !SELECT: subquery must return only one column CODE = 42000 -MAPI = (monetdb) /var/tmp/mtest-6744/.s.monetdb.35025 +MAPI = (monetdb) /var/tmp/mtest-201361/.s.monetdb.35931 +QUERY = SELECT i1.i, i2.i FROM integers i1, integers i2 HAVING (SELECT SUM(i2.i + i1.i)) > 0; --error, cannot use non GROUP BY column 'i1.i' in query results without an aggregate function +ERROR = !SELECT: cannot use non GROUP BY column 'i1.i' in query results without an aggregate function +CODE = 42000 +MAPI = (monetdb) /var/tmp/mtest-201361/.s.monetdb.35931 QUERY = UPDATE another_T SET col1 = MIN(col1); --error, aggregates not allowed in update set clause ERROR = !MIN: aggregate functions not allowed in SET clause (use subquery) CODE = 42000 diff --git a/sql/test/subquery/Tests/subquery4.stable.out b/sql/test/subquery/Tests/subquery4.stable.out --- a/sql/test/subquery/Tests/subquery4.stable.out +++ b/sql/test/subquery/Tests/subquery4.stable.out @@ -170,6 +170,49 @@ stdout of test 'subquery4` in directory [ 1 ] [ 1 ] [ NULL ] +#SELECT (SELECT SUM(i2.i + i1.i)) FROM integers i1, integers i2; +% .%1 # table_name +% %1 # name +% bigint # type +% 1 # length +[ 2 ] +[ 3 ] +[ 4 ] +[ NULL ] +[ 3 ] +[ 4 ] +[ 5 ] +[ NULL ] +[ 4 ] +[ 5 ] +[ 6 ] +[ NULL ] +[ NULL ] +[ NULL ] +[ NULL ] +[ NULL ] +#SELECT (SELECT SUM(i2.i + i1.i)) FROM integers i1 INNER JOIN integers i2 ON i1.i = i2.i; +% .%3 # table_name +% %3 # name +% bigint # type +% 1 # length +[ 2 ] +[ 4 ] +[ 6 ] +#SELECT i1.i, i2.i FROM integers i1, integers i2 WHERE (SELECT SUM(i2.i + i1.i)) > 0; +% sys.i1, sys.i2 # table_name +% i, i # name +% int, int # type +% 1, 1 # length +[ 1, 1 ] +[ 1, 2 ] +[ 1, 3 ] +[ 2, 1 ] +[ 2, 2 ] +[ 2, 3 ] +[ 3, 1 ] +[ 3, 2 ] +[ 3, 3 ] #UPDATE another_T SET col4 = (SELECT SUM(col4 + ColID) FROM tbl_ProductSales); --4 rows affected [ 4 ] #SELECT col4 FROM another_T; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list