Changeset: 3da0638e369e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3da0638e369e
Added Files:
sql/test/bugs/Tests/cur_date_crash-JIRA-42.sql
sql/test/bugs/Tests/cur_date_crash-JIRA-42.stable.err
sql/test/bugs/Tests/cur_date_crash-JIRA-42.stable.out
Modified Files:
sql/server/rel_optimizer.c
sql/test/bugs/Tests/All
Branch: Jul2015
Log Message:
Fix JIRA issue 42, test added
Stop when there are no more 'refs', this should prevent the combination of
CURDATE() and NOT IN from crashing the server
diffs (137 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
@@ -2182,6 +2182,8 @@ ambigious_refs( list *exps, list *refs)
{
node *n;
+ if (!refs)
+ return 0;
for(n=refs->h; n; n = n->next) {
if (ambigious_ref(exps, n->data))
return 1;
diff --git a/sql/test/bugs/Tests/All b/sql/test/bugs/Tests/All
--- a/sql/test/bugs/Tests/All
+++ b/sql/test/bugs/Tests/All
@@ -105,3 +105,4 @@ polymorphism
emili
substring_limit_bug
apply_with_union_assertion
+cur_date_crash-JIRA-42
diff --git a/sql/test/bugs/Tests/cur_date_crash-JIRA-42.sql
b/sql/test/bugs/Tests/cur_date_crash-JIRA-42.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/bugs/Tests/cur_date_crash-JIRA-42.sql
@@ -0,0 +1,10 @@
+CREATE TABLE foo (bar int);
+CREATE TABLE foo1 (bar int);
+
+SELECT bar FROM foo WHERE bar NOT IN (SELECT bar FROM foo1);
+
+SELECT CURDATE() FROM foo;
+
+SELECT CURDATE() FROM foo WHERE bar NOT IN (SELECT bar FROM foo1);
+drop table foo1;
+drop table foo;
diff --git a/sql/test/bugs/Tests/cur_date_crash-JIRA-42.stable.err
b/sql/test/bugs/Tests/cur_date_crash-JIRA-42.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/bugs/Tests/cur_date_crash-JIRA-42.stable.err
@@ -0,0 +1,37 @@
+stderr of test 'cur_date_crash-JIRA-42` in directory 'sql/test/bugs` itself:
+
+
+# 19:47:16 >
+# 19:47:16 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=36422" "--set"
"mapi_usock=/var/tmp/mtest-30463/.s.monetdb.36422" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_bugs"
"--set" "mal_listing=0" "--set" "embedded_r=yes"
+# 19:47:16 >
+
+# builtin opt gdk_dbpath =
/home/niels/scratch/rc-monetdb/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 = 36422
+# cmdline opt mapi_usock = /var/tmp/mtest-30463/.s.monetdb.36422
+# cmdline opt monet_prompt =
+# cmdline opt mal_listing = 2
+# cmdline opt gdk_dbpath =
/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_bugs
+# cmdline opt mal_listing = 0
+# cmdline opt embedded_r = yes
+# cmdline opt gdk_debug = 536870922
+
+# 19:47:17 >
+# 19:47:17 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-30463" "--port=36422"
+# 19:47:17 >
+
+
+# 19:47:17 >
+# 19:47:17 > "Done."
+# 19:47:17 >
+
diff --git a/sql/test/bugs/Tests/cur_date_crash-JIRA-42.stable.out
b/sql/test/bugs/Tests/cur_date_crash-JIRA-42.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/bugs/Tests/cur_date_crash-JIRA-42.stable.out
@@ -0,0 +1,55 @@
+stdout of test 'cur_date_crash-JIRA-42` in directory 'sql/test/bugs` itself:
+
+
+# 19:47:16 >
+# 19:47:16 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=36422" "--set"
"mapi_usock=/var/tmp/mtest-30463/.s.monetdb.36422" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_bugs"
"--set" "mal_listing=0" "--set" "embedded_r=yes"
+# 19:47:16 >
+
+# MonetDB 5 server v11.21.18
+# This is an unreleased version
+# Serving database 'mTests_sql_test_bugs', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs and 128bit
integers dynamically linked
+# Found 7.332 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://localhost.nes.nl:36422/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-30463/.s.monetdb.36422
+# MonetDB/GIS module loaded
+# Start processing logs sql/sql_logs version 52200
+# Start reading the write-ahead log 'sql_logs/sql/log.68'
+# Finished reading the write-ahead log 'sql_logs/sql/log.68'
+# Finished processing logs sql/sql_logs
+# MonetDB/SQL module loaded
+# MonetDB/R module loaded
+
+Ready.
+
+# 19:47:17 >
+# 19:47:17 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-30463" "--port=36422"
+# 19:47:17 >
+
+#CREATE TABLE foo (bar int);
+#CREATE TABLE foo1 (bar int);
+#SELECT bar FROM foo WHERE bar NOT IN (SELECT bar FROM foo1);
+% sys.foo # table_name
+% bar # name
+% int # type
+% 1 # length
+#SELECT CURDATE() FROM foo;
+% .L # table_name
+% curdate # name
+% date # type
+% 10 # length
+#SELECT CURDATE() FROM foo WHERE bar NOT IN (SELECT bar FROM foo1);
+% .L3 # table_name
+% curdate # name
+% date # type
+% 10 # length
+#drop table foo1;
+#drop table foo;
+
+# 19:47:17 >
+# 19:47:17 > "Done."
+# 19:47:17 >
+
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list