Changeset: c5338ccd7803 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c5338ccd7803
Added Files:
sql/test/BugTracker-2014/Tests/crash_on_or_with_in.Bug-3461.sql
sql/test/BugTracker-2014/Tests/crash_on_or_with_in.Bug-3461.stable.err
sql/test/BugTracker-2014/Tests/crash_on_or_with_in.Bug-3461.stable.out
sql/test/BugTracker-2014/Tests/in_incorrect_multi.Bug-3462.sql
sql/test/BugTracker-2014/Tests/in_incorrect_multi.Bug-3462.stable.err
sql/test/BugTracker-2014/Tests/in_incorrect_multi.Bug-3462.stable.out
Modified Files:
sql/server/rel_optimizer.c
sql/server/rel_select.c
sql/test/BugTracker-2014/Tests/All
sql/test/BugTracker-2014/Tests/select-having.Bug-3458.stable.err
sql/test/BugTracker-2014/Tests/select-having.Bug-3458.stable.out
Branch: Jan2014
Log Message:
fixed bugs 3458, 3461 and 3462
3461 added missing select
3462 check number of columns
diffs (truncated from 317 to 300 lines):
diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -4760,8 +4760,9 @@ rel_remove_unused(mvc *sql, sql_rel *rel
if (e->used)
append(exps, e);
}
- /* atleast one (needed for crossproducts, count(*),
rank() and single value projections) !, handled by exps_mark_used */
- assert(list_length(exps) > 0);
+ /* atleast one (needed for crossproducts, count(*),
rank() and single value projections) */
+ if (list_length(exps) <= 0)
+ append(exps, rel->exps->h->data);
rel->exps = exps;
}
return rel;
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -2909,7 +2909,8 @@ rel_logical_exp(mvc *sql, sql_rel *rel,
l->card != CARD_ATOM && has_nil(l)) {
e = rel_unop_(sql, l, NULL, "isnull", card_value);
e = exp_compare(sql->sa, e, exp_atom_bool(sql->sa, 0),
cmp_equal);
- if (!is_select(rel->op) && !rel_is_ref(rel))
+ if (!is_select(rel->op))
+ // && !rel_is_ref(rel))
left = rel = rel_select(sql->sa, rel, e);
else
rel_select_add_exp(sql->sa, rel, e);
@@ -2958,6 +2959,8 @@ rel_logical_exp(mvc *sql, sql_rel *rel,
r = rel_value_exp(sql, &z, sval, f, ek);
if (z)
r_is_rel = 1;
+ if (z && is_project(z->op) &&
list_length(z->exps) != 1)
+ return sql_error(sql, 02, "IN:
iinner query should return a single column");
if (!r && sql->session->status !=
-ERR_AMBIGUOUS) {
/* reset error */
sql->session->status = 0;
diff --git a/sql/test/BugTracker-2014/Tests/All
b/sql/test/BugTracker-2014/Tests/All
--- a/sql/test/BugTracker-2014/Tests/All
+++ b/sql/test/BugTracker-2014/Tests/All
@@ -11,3 +11,5 @@ utf8bom.Bug-3436
left-outer-join-with-and.Bug-3444
setreadonly_forgets_changes.Bug-3446
select-having.Bug-3458
+crash_on_or_with_in.Bug-3461
+in_incorrect_multi.Bug-3462
diff --git a/sql/test/BugTracker-2014/Tests/crash_on_or_with_in.Bug-3461.sql
b/sql/test/BugTracker-2014/Tests/crash_on_or_with_in.Bug-3461.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2014/Tests/crash_on_or_with_in.Bug-3461.sql
@@ -0,0 +1,3 @@
+SELECT * FROM SYS.ARGS
+ WHERE FUNC_ID NOT IN (SELECT ID FROM SYS.FUNCTIONS)
+ OR FUNC_ID NOT IN (SELECT ID FROM SYS.FUNCTIONS);
diff --git
a/sql/test/BugTracker-2014/Tests/crash_on_or_with_in.Bug-3461.stable.err
b/sql/test/BugTracker-2014/Tests/crash_on_or_with_in.Bug-3461.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2014/Tests/crash_on_or_with_in.Bug-3461.stable.err
@@ -0,0 +1,35 @@
+stderr of test 'crash_on_or_with_in.Bug-3461` in directory
'sql/test/BugTracker-2014` itself:
+
+
+# 14:17:10 >
+# 14:17:10 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=39561" "--set"
"mapi_usock=/var/tmp/mtest-1586/.s.monetdb.39561" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014"
"--set" "mal_listing=0"
+# 14:17:10 >
+
+# builtin opt gdk_dbpath =
/home/niels/scratch/rc-clean/Linux-x86_64/var/monetdb5/dbfarm/demo
+# builtin opt gdk_debug = 0
+# builtin opt gdk_vmtrim = no
+# builtin opt monet_prompt = >
+# builtin opt monet_daemon = no
+# builtin opt mapi_port = 50000
+# builtin opt mapi_open = false
+# builtin opt mapi_autosense = false
+# builtin opt sql_optimizer = default_pipe
+# builtin opt sql_debug = 0
+# cmdline opt gdk_nr_threads = 0
+# cmdline opt mapi_open = true
+# cmdline opt mapi_port = 39561
+# cmdline opt mapi_usock = /var/tmp/mtest-1586/.s.monetdb.39561
+# cmdline opt monet_prompt =
+# cmdline opt mal_listing = 2
+# cmdline opt gdk_dbpath =
/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014
+# cmdline opt mal_listing = 0
+
+# 14:17:10 >
+# 14:17:10 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-1586" "--port=39561"
+# 14:17:10 >
+
+
+# 14:17:10 >
+# 14:17:10 > "Done."
+# 14:17:10 >
+
diff --git
a/sql/test/BugTracker-2014/Tests/crash_on_or_with_in.Bug-3461.stable.out
b/sql/test/BugTracker-2014/Tests/crash_on_or_with_in.Bug-3461.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2014/Tests/crash_on_or_with_in.Bug-3461.stable.out
@@ -0,0 +1,39 @@
+stdout of test 'crash_on_or_with_in.Bug-3461` in directory
'sql/test/BugTracker-2014` itself:
+
+
+# 14:17:10 >
+# 14:17:10 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=39561" "--set"
"mapi_usock=/var/tmp/mtest-1586/.s.monetdb.39561" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014"
"--set" "mal_listing=0"
+# 14:17:10 >
+
+# MonetDB 5 server v11.17.14
+# This is an unreleased version
+# Serving database 'mTests_sql_test_BugTracker-2014', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically
linked
+# Found 7.334 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2014 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://localhost.nes.nl:39561/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-1586/.s.monetdb.39561
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 14:17:10 >
+# 14:17:10 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-1586" "--port=39561"
+# 14:17:10 >
+
+#SELECT * FROM SYS.ARGS
+# WHERE FUNC_ID NOT IN (SELECT ID FROM SYS.FUNCTIONS)
+# OR FUNC_ID NOT IN (SELECT ID FROM SYS.FUNCTIONS);
+% .args, .args, .args, .args, .args, .args, .args # table_name
+% id, func_id, name, type, type_digits, type_scale, number
# name
+% int, int, varchar, varchar, int, int, int # type
+% 1, 1, 0, 0, 1, 1, 1 # length
+
+# 14:17:10 >
+# 14:17:10 > "Done."
+# 14:17:10 >
+
diff --git a/sql/test/BugTracker-2014/Tests/in_incorrect_multi.Bug-3462.sql
b/sql/test/BugTracker-2014/Tests/in_incorrect_multi.Bug-3462.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2014/Tests/in_incorrect_multi.Bug-3462.sql
@@ -0,0 +1,4 @@
+SELECT * FROM SYS.ARGS
+ WHERE FUNC_ID NOT IN (SELECT * FROM SYS.FUNCTIONS);
+SELECT * FROM SYS.ARGS
+ WHERE FUNC_ID NOT IN (SELECT FUNC_ID FROM SYS.FUNCTIONS);
diff --git
a/sql/test/BugTracker-2014/Tests/in_incorrect_multi.Bug-3462.stable.err
b/sql/test/BugTracker-2014/Tests/in_incorrect_multi.Bug-3462.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2014/Tests/in_incorrect_multi.Bug-3462.stable.err
@@ -0,0 +1,39 @@
+stderr of test 'in_incorrect_multi.Bug-3462` in directory
'sql/test/BugTracker-2014` itself:
+
+
+# 14:17:10 >
+# 14:17:10 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=39561" "--set"
"mapi_usock=/var/tmp/mtest-1586/.s.monetdb.39561" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014"
"--set" "mal_listing=0"
+# 14:17:10 >
+
+# builtin opt gdk_dbpath =
/home/niels/scratch/rc-clean/Linux-x86_64/var/monetdb5/dbfarm/demo
+# builtin opt gdk_debug = 0
+# builtin opt gdk_vmtrim = no
+# builtin opt monet_prompt = >
+# builtin opt monet_daemon = no
+# builtin opt mapi_port = 50000
+# builtin opt mapi_open = false
+# builtin opt mapi_autosense = false
+# builtin opt sql_optimizer = default_pipe
+# builtin opt sql_debug = 0
+# cmdline opt gdk_nr_threads = 0
+# cmdline opt mapi_open = true
+# cmdline opt mapi_port = 39561
+# cmdline opt mapi_usock = /var/tmp/mtest-1586/.s.monetdb.39561
+# cmdline opt monet_prompt =
+# cmdline opt mal_listing = 2
+# cmdline opt gdk_dbpath =
/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014
+# cmdline opt mal_listing = 0
+
+# 14:17:11 >
+# 14:17:11 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-1586" "--port=39561"
+# 14:17:11 >
+
+MAPI = (monetdb) /var/tmp/mtest-1586/.s.monetdb.39561
+QUERY = SELECT * FROM SYS.ARGS
+ WHERE FUNC_ID NOT IN (SELECT * FROM SYS.FUNCTIONS);
+ERROR = !IN: iinner query should return a single column
+
+# 14:17:13 >
+# 14:17:13 > "Done."
+# 14:17:13 >
+
diff --git
a/sql/test/BugTracker-2014/Tests/in_incorrect_multi.Bug-3462.stable.out
b/sql/test/BugTracker-2014/Tests/in_incorrect_multi.Bug-3462.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2014/Tests/in_incorrect_multi.Bug-3462.stable.out
@@ -0,0 +1,38 @@
+stdout of test 'in_incorrect_multi.Bug-3462` in directory
'sql/test/BugTracker-2014` itself:
+
+
+# 14:17:10 >
+# 14:17:10 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=39561" "--set"
"mapi_usock=/var/tmp/mtest-1586/.s.monetdb.39561" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014"
"--set" "mal_listing=0"
+# 14:17:10 >
+
+# MonetDB 5 server v11.17.14
+# This is an unreleased version
+# Serving database 'mTests_sql_test_BugTracker-2014', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically
linked
+# Found 7.334 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2014 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://localhost.nes.nl:39561/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-1586/.s.monetdb.39561
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 14:17:11 >
+# 14:17:11 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-1586" "--port=39561"
+# 14:17:11 >
+
+#SELECT * FROM SYS.ARGS
+# WHERE FUNC_ID NOT IN (SELECT FUNC_ID FROM SYS.FUNCTIONS);
+% sys.args, sys.args, sys.args, sys.args, sys.args,
sys.args, sys.args # table_name
+% id, func_id, name, type, type_digits, type_scale, number
# name
+% int, int, varchar, varchar, int, int, int # type
+% 1, 1, 0, 0, 1, 1, 1 # length
+
+# 14:17:13 >
+# 14:17:13 > "Done."
+# 14:17:13 >
+
diff --git a/sql/test/BugTracker-2014/Tests/select-having.Bug-3458.stable.err
b/sql/test/BugTracker-2014/Tests/select-having.Bug-3458.stable.err
--- a/sql/test/BugTracker-2014/Tests/select-having.Bug-3458.stable.err
+++ b/sql/test/BugTracker-2014/Tests/select-having.Bug-3458.stable.err
@@ -1,1 +1,35 @@
-This should not crash.
+stderr of test 'select-having.Bug-3458` in directory
'sql/test/BugTracker-2014` itself:
+
+
+# 14:17:10 >
+# 14:17:10 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=39561" "--set"
"mapi_usock=/var/tmp/mtest-1586/.s.monetdb.39561" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014"
"--set" "mal_listing=0"
+# 14:17:10 >
+
+# builtin opt gdk_dbpath =
/home/niels/scratch/rc-clean/Linux-x86_64/var/monetdb5/dbfarm/demo
+# builtin opt gdk_debug = 0
+# builtin opt gdk_vmtrim = no
+# builtin opt monet_prompt = >
+# builtin opt monet_daemon = no
+# builtin opt mapi_port = 50000
+# builtin opt mapi_open = false
+# builtin opt mapi_autosense = false
+# builtin opt sql_optimizer = default_pipe
+# builtin opt sql_debug = 0
+# cmdline opt gdk_nr_threads = 0
+# cmdline opt mapi_open = true
+# cmdline opt mapi_port = 39561
+# cmdline opt mapi_usock = /var/tmp/mtest-1586/.s.monetdb.39561
+# cmdline opt monet_prompt =
+# cmdline opt mal_listing = 2
+# cmdline opt gdk_dbpath =
/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014
+# cmdline opt mal_listing = 0
+
+# 14:17:10 >
+# 14:17:10 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-1586" "--port=39561"
+# 14:17:10 >
+
+
+# 14:17:10 >
+# 14:17:10 > "Done."
+# 14:17:10 >
+
diff --git a/sql/test/BugTracker-2014/Tests/select-having.Bug-3458.stable.out
b/sql/test/BugTracker-2014/Tests/select-having.Bug-3458.stable.out
--- a/sql/test/BugTracker-2014/Tests/select-having.Bug-3458.stable.out
+++ b/sql/test/BugTracker-2014/Tests/select-having.Bug-3458.stable.out
@@ -1,1 +1,38 @@
-This should not crash.
+stdout of test 'select-having.Bug-3458` in directory
'sql/test/BugTracker-2014` itself:
+
+
+# 14:17:10 >
+# 14:17:10 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=39561" "--set"
"mapi_usock=/var/tmp/mtest-1586/.s.monetdb.39561" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2014"
"--set" "mal_listing=0"
+# 14:17:10 >
+
+# MonetDB 5 server v11.17.14
+# This is an unreleased version
+# Serving database 'mTests_sql_test_BugTracker-2014', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically
linked
+# Found 7.334 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2014 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://localhost.nes.nl:39561/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-1586/.s.monetdb.39561
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list