Changeset: d141a1e54895 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d141a1e54895
Added Files:
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.err
        
sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.out
        sql/test/mergetables/Tests/sqlsmith.Bug-6480.sql
        sql/test/mergetables/Tests/sqlsmith.Bug-6480.stable.err
        sql/test/mergetables/Tests/sqlsmith.Bug-6480.stable.out
Modified Files:
        sql/server/rel_select.c
        sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.err
        sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.out
        sql/test/mergetables/Tests/All
Branch: Jul2017
Log Message:

fix bug 6490, ie add missing 'in' function and handeling


diffs (truncated from 308 to 300 lines):

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
@@ -2132,6 +2132,32 @@ rel_logical_value_exp(mvc *sql, sql_rel 
                                        if (l)
                                                st = exp_subtype(l);
                                }
+                               if (l && !r && !n->next) { /* possibly a (not) 
in function call */
+                                       /* reset error */
+                                       sql->session->status = 0;
+                                       sql->errstr[0] = 0;
+
+                                       z = left;
+                                       r = rel_value_exp(sql, &z, sval, f, 
ek); 
+                                       if (z == left && r) {
+                                               sql_subfunc *f = NULL;
+
+                                               l = rel_check_type(sql, 
exp_subtype(r), l, type_equal);
+                                               if (!l) 
+                                                       return NULL;
+                                               f = sql_bind_func(sql->sa, 
sql->session->schema, "=", exp_subtype(l), exp_subtype(r), F_FUNC);
+                                               if (f)
+                                                       l = exp_binop(sql->sa, 
l, r, f);
+                                               if (f && l && sc->token == 
SQL_NOT_IN) {
+                                                       f = 
sql_bind_func(sql->sa, sql->session->schema, "not", exp_subtype(l), NULL, 
F_FUNC);
+                                                       return 
exp_unop(sql->sa, l, f);
+                                               } else if (f && l && sc->token 
== SQL_IN) {
+                                                       return l;
+                                               }
+
+                                       }       
+                                       r = NULL;
+                               }
                                if (!l || !r || !(r=rel_check_type(sql, st, r, 
type_equal))) {
                                        rel_destroy(right);
                                        return NULL;
diff --git 
a/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.err 
b/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.err
--- a/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.err
+++ b/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.err
@@ -27,9 +27,6 @@ stderr of test 'crash_in_in_handling.Bug
 # 14:07:27 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-29945" "--port=39677"
 # 14:07:27 >  
 
-MAPI  = (monetdb) /var/tmp/mtest-29945/.s.monetdb.39677
-QUERY = SELECT * FROM tab0 AS cor0 WHERE NOT NULL IN ( col3 );
-ERROR = !SELECT: identifier 'col3' unknown
 
 # 14:07:27 >  
 # 14:07:27 >  "Done."
diff --git 
a/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.out 
b/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.out
--- a/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.out
+++ b/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.out
@@ -45,6 +45,11 @@ Ready.
 [ 1    ]
 #INSERT INTO tab0 VALUES(9,501,776.40,'cvygg',725,75.5,'etlyv');
 [ 1    ]
+#SELECT * FROM tab0 AS cor0 WHERE NOT NULL IN ( col3 );
+% sys.cor0,    sys.cor0,       sys.cor0,       sys.cor0,       sys.cor0,       
sys.cor0,       sys.cor0 # table_name
+% pk,  col0,   col1,   col2,   col3,   col4,   col5 # name
+% int, int,    double, clob,   int,    double, clob # type
+% 1,   1,      24,     0,      1,      24,     0 # length
 #drop table tab0;
 
 # 14:07:27 >  
diff --git 
a/sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.err
 
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.err
new file mode 100644
--- /dev/null
+++ 
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.err
@@ -0,0 +1,34 @@
+stderr of test 'sqlitelogictest-select-in-column.Bug-6490` in directory 
'sql/test/BugTracker-2017` itself:
+
+
+# 23:22:13 >  
+# 23:22:13 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=34932" "--set" 
"mapi_usock=/var/tmp/mtest-13741/.s.monetdb.34932" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2017"
+# 23:22:13 >  
+
+# 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 = 34932
+# cmdline opt  mapi_usock = /var/tmp/mtest-13741/.s.monetdb.34932
+# cmdline opt  monet_prompt = 
+# cmdline opt  gdk_dbpath = 
/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2017
+# cmdline opt  gdk_debug = 536870922
+
+# 23:22:13 >  
+# 23:22:13 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-13741" "--port=34932"
+# 23:22:13 >  
+
+
+# 23:22:13 >  
+# 23:22:13 >  "Done."
+# 23:22:13 >  
+
diff --git 
a/sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.out
 
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.out
new file mode 100644
--- /dev/null
+++ 
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-select-in-column.Bug-6490.stable.out
@@ -0,0 +1,38 @@
+stdout of test 'sqlitelogictest-select-in-column.Bug-6490` in directory 
'sql/test/BugTracker-2017` itself:
+
+
+# 23:22:13 >  
+# 23:22:13 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=34932" "--set" 
"mapi_usock=/var/tmp/mtest-13741/.s.monetdb.34932" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2017"
+# 23:22:13 >  
+
+# MonetDB 5 server v11.27.6
+# This is an unreleased version
+# Serving database 'mTests_sql_test_BugTracker-2017', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers
+# Found 7.330 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
+# Visit https://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://localhost.nes.nl:34932/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-13741/.s.monetdb.34932
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 23:22:13 >  
+# 23:22:13 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-13741" "--port=34932"
+# 23:22:13 >  
+
+#CREATE TABLE tab0(pk INTEGER PRIMARY KEY, col0 INTEGER, col1 FLOAT, col2 
TEXT, col3 INTEGER, col4 FLOAT, col5 TEXT);
+#SELECT ALL * FROM tab0 AS cor0 WHERE NOT CAST ( NULL AS INTEGER ) NOT IN ( 
col3 / col1 );
+% sys.cor0,    sys.cor0,       sys.cor0,       sys.cor0,       sys.cor0,       
sys.cor0,       sys.cor0 # table_name
+% pk,  col0,   col1,   col2,   col3,   col4,   col5 # name
+% int, int,    double, clob,   int,    double, clob # type
+% 1,   1,      24,     0,      1,      24,     0 # length
+#DROP TABLE tab0;
+
+# 23:22:13 >  
+# 23:22:13 >  "Done."
+# 23:22:13 >  
+
diff --git a/sql/test/mergetables/Tests/All b/sql/test/mergetables/Tests/All
--- a/sql/test/mergetables/Tests/All
+++ b/sql/test/mergetables/Tests/All
@@ -30,4 +30,6 @@ HAVE_GEOM?sqlsmith.Bug-6459
 HAVE_NETCDF?sqlsmith-exist-lateral
 HAVE_NETCDF?sqlsmith-apply-outer-join-or
 HAVE_NETCDF?sqlsmith.Bug-6472
+sqlsmith.Bug-6480
 mergedb_drop
+
diff --git a/sql/test/mergetables/Tests/sqlsmith.Bug-6480.sql 
b/sql/test/mergetables/Tests/sqlsmith.Bug-6480.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/mergetables/Tests/sqlsmith.Bug-6480.sql
@@ -0,0 +1,46 @@
+select  
+  64 as c0, 
+  ref_12.y as c1, 
+  ref_12.y as c2, 
+  case when true then ref_12.z else ref_12.z end
+     as c3, 
+  cast(coalesce(ref_12.b,
+    ref_12.b) as boolean) as c4, 
+  ref_12.x as c5
+from 
+  sys.s as ref_12
+where EXISTS (
+  select  
+      ref_17.keyword as c0, 
+      subq_0.c5 as c1, 
+      ref_12.x as c2, 
+      subq_0.c1 as c3, 
+      ref_17.keyword as c4, 
+      subq_0.c6 as c5, 
+      ref_17.keyword as c6, 
+      subq_0.c9 as c7, 
+      ref_12.z as c8, 
+      ref_12.y as c9, 
+      23 as c10, 
+      subq_0.c1 as c11
+    from 
+      sys.keywords as ref_17
+        left join (select  
+              ref_19.y as c0, 
+              ref_12.x as c1, 
+              ref_19.z as c2, 
+              ref_19.y as c3, 
+              ref_12.z as c4, 
+              ref_12.y as c5, 
+              ref_19.y as c6, 
+              24 as c7, 
+              ref_12.b as c8, 
+              ref_12.z as c9
+            from 
+              sys.r2 as ref_19
+            where false
+            limit 79) as subq_0
+        on ((subq_0.c4 is NULL) 
+            or (subq_0.c2 is NULL))
+    where false)
+limit 123;
diff --git a/sql/test/mergetables/Tests/sqlsmith.Bug-6480.stable.err 
b/sql/test/mergetables/Tests/sqlsmith.Bug-6480.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/mergetables/Tests/sqlsmith.Bug-6480.stable.err
@@ -0,0 +1,60 @@
+stderr of test 'sqlsmith.Bug-6480` in directory 'sql/test/mergetables` itself:
+
+
+# 23:33:03 >  
+# 23:33:03 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=34932" "--set" 
"mapi_usock=/var/tmp/mtest-13741/.s.monetdb.34932" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_mergetables"
+# 23:33:03 >  
+
+# 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 = 34932
+# cmdline opt  mapi_usock = /var/tmp/mtest-13741/.s.monetdb.34932
+# cmdline opt  monet_prompt = 
+# cmdline opt  gdk_dbpath = 
/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_mergetables
+# cmdline opt  gdk_debug = 536870922
+
+# 23:33:04 >  
+# 23:33:04 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-13741" "--port=34932"
+# 23:33:04 >  
+
+MAPI  = (monetdb) /var/tmp/mtest-13741/.s.monetdb.34932
+QUERY = select  
+          64 as c0, 
+          ref_12.y as c1, 
+          ref_12.y as c2, 
+          case when true then ref_12.z else ref_12.z end
+             as c3, 
+          cast(coalesce(ref_12.b,
+            ref_12.b) as boolean) as c4, 
+          ref_12.x as c5
+        from 
+          sys.s as ref_12
+        where EXISTS (
+          select  
+              ref_17.keyword as c0, 
+              subq_0.c5 as c1, 
+              ref_12.x as c2, 
+              subq_0.c1 as c3, 
+              ref_17.keyword as c4, 
+              subq_0.c6 as c5, 
+              ref_17.keyword as c6, 
+              subq_0.c9 as c7, 
+              ref_12.z as c8, 
+              ref_12.y as c9, 
+              23 as c10, 
+ERROR = !SELECT: no such column 'ref_12.b'
+
+# 23:33:04 >  
+# 23:33:04 >  "Done."
+# 23:33:04 >  
+
diff --git a/sql/test/mergetables/Tests/sqlsmith.Bug-6480.stable.out 
b/sql/test/mergetables/Tests/sqlsmith.Bug-6480.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/mergetables/Tests/sqlsmith.Bug-6480.stable.out
@@ -0,0 +1,31 @@
+stdout of test 'sqlsmith.Bug-6480` in directory 'sql/test/mergetables` itself:
+
+
+# 23:33:03 >  
+# 23:33:03 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=34932" "--set" 
"mapi_usock=/var/tmp/mtest-13741/.s.monetdb.34932" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_mergetables"
+# 23:33:03 >  
+
+# MonetDB 5 server v11.27.6
+# This is an unreleased version
+# Serving database 'mTests_sql_test_mergetables', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers
+# Found 7.330 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved
+# Visit https://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://localhost.nes.nl:34932/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-13741/.s.monetdb.34932
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 23:33:04 >  
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to