Changeset: bc4e4730f58d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bc4e4730f58d
Added Files:
sql/test/BugTracker-2017/Tests/sqlitelogictest-hidden-alias.Bug-6495.stable.err
sql/test/BugTracker-2017/Tests/sqlitelogictest-hidden-alias.Bug-6495.stable.out
sql/test/BugTracker-2017/Tests/union_all_null.Bug-6487.sql
sql/test/BugTracker-2017/Tests/union_all_null.Bug-6487.stable.err
sql/test/BugTracker-2017/Tests/union_all_null.Bug-6487.stable.out
Modified Files:
sql/server/rel_select.c
sql/server/sql_semantic.h
sql/test/BugDay_2005-10-06_2.9.3/Tests/simple_union.SF-1005596.stable.out
sql/test/BugTracker-2012/Tests/null_except_null.Bug-3040.stable.out
sql/test/bugs/Tests/subselect_multiple_unionall_where_1=1-bug-sf-1005596.stable.out
sql/test/bugs/Tests/union_all-bug-sf-941788.stable.out
Branch: Jul2017
Log Message:
fixed bug 6487, ie handle union all null properly
diffs (294 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
@@ -1443,7 +1443,7 @@ rel_convert_types(mvc *sql, sql_exp **L,
sql_subtype *i = lt;
sql_subtype *r = rt;
- if (subtype_cmp(lt, rt) != 0 || lt->type->localtype==0 ||
rt->type->localtype==0) {
+ if (subtype_cmp(lt, rt) != 0 || (tpe == type_equal_no_any &&
(lt->type->localtype==0 || rt->type->localtype==0))) {
sql_subtype super;
supertype(&super, r, i);
@@ -2592,7 +2592,7 @@ rel_logical_exp(mvc *sql, sql_rel *rel,
sql_exp *e;
l = ll->h->data;
- if (rel_convert_types(sql, &l, &r, 1,
type_equal) < 0)
+ if (rel_convert_types(sql, &l, &r, 1,
type_equal_no_any) < 0)
return NULL;
e = exp_compare(sql->sa, l, r,
cmp_equal );
if (!e)
diff --git a/sql/server/sql_semantic.h b/sql/server/sql_semantic.h
--- a/sql/server/sql_semantic.h
+++ b/sql/server/sql_semantic.h
@@ -34,6 +34,7 @@ extern sql_subtype *supertype(sql_subtyp
typedef enum {
type_set, /* set operations have very limiting coersion rules */
type_equal,
+ type_equal_no_any,
type_cast /* also truncate */
} check_type;
diff --git
a/sql/test/BugDay_2005-10-06_2.9.3/Tests/simple_union.SF-1005596.stable.out
b/sql/test/BugDay_2005-10-06_2.9.3/Tests/simple_union.SF-1005596.stable.out
--- a/sql/test/BugDay_2005-10-06_2.9.3/Tests/simple_union.SF-1005596.stable.out
+++ b/sql/test/BugDay_2005-10-06_2.9.3/Tests/simple_union.SF-1005596.stable.out
@@ -26,8 +26,8 @@ Ready.
% .tables, .tables, .tables, .tables, .tables,
.tables, .tables, .tables, .tables, .tables #
table_name
% TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, REMARKS,
TYPE_CAT, TYPE_SCHEM, TYPE_NAME, SELF_REFERENCING_COL_NAME,
REF_GENERATION # name
-% char, varchar, varchar, char, char, smallint,
smallint, smallint, char, char # type
-% 4, 3, 4, 20, 0, 1, 1, 1, 5, 6 #
length
+% char, varchar, varchar, char, char, char, char,
char, char, char # type
+% 4, 3, 4, 20, 0, 0, 0, 0, 5, 6 #
length
[ "demo", "sys", "test", "TABLE", "", NULL, NULL, NULL,
"rowid", "SYSTEM" ]
# 12:42:09 >
diff --git
a/sql/test/BugTracker-2012/Tests/null_except_null.Bug-3040.stable.out
b/sql/test/BugTracker-2012/Tests/null_except_null.Bug-3040.stable.out
--- a/sql/test/BugTracker-2012/Tests/null_except_null.Bug-3040.stable.out
+++ b/sql/test/BugTracker-2012/Tests/null_except_null.Bug-3040.stable.out
@@ -50,8 +50,8 @@ Ready.
#SELECT null EXCEPT SELECT null;
% .L11 # table_name
% L2 # name
-% smallint # type
-% 1 # length
+% char # type
+% 0 # length
# 14:34:20 >
# 14:34:20 > "Done."
diff --git
a/sql/test/BugTracker-2017/Tests/sqlitelogictest-hidden-alias.Bug-6495.stable.err
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-hidden-alias.Bug-6495.stable.err
new file mode 100644
--- /dev/null
+++
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-hidden-alias.Bug-6495.stable.err
@@ -0,0 +1,34 @@
+stderr of test 'sqlitelogictest-hidden-alias.Bug-6495` in directory
'sql/test/BugTracker-2017` itself:
+
+
+# 16:03:47 >
+# 16:03:47 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=36305" "--set"
"mapi_usock=/var/tmp/mtest-2035/.s.monetdb.36305" "--set" "monet_prompt="
"--forcemito"
"--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2017"
+# 16:03:47 >
+
+# 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 = 36305
+# cmdline opt mapi_usock = /var/tmp/mtest-2035/.s.monetdb.36305
+# 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 = 553648138
+
+# 16:03:47 >
+# 16:03:47 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-2035" "--port=36305"
+# 16:03:47 >
+
+
+# 16:03:47 >
+# 16:03:47 > "Done."
+# 16:03:47 >
+
diff --git
a/sql/test/BugTracker-2017/Tests/sqlitelogictest-hidden-alias.Bug-6495.stable.out
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-hidden-alias.Bug-6495.stable.out
new file mode 100644
--- /dev/null
+++
b/sql/test/BugTracker-2017/Tests/sqlitelogictest-hidden-alias.Bug-6495.stable.out
@@ -0,0 +1,54 @@
+stdout of test 'sqlitelogictest-hidden-alias.Bug-6495` in directory
'sql/test/BugTracker-2017` itself:
+
+
+# 16:03:47 >
+# 16:03:47 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=36305" "--set"
"mapi_usock=/var/tmp/mtest-2035/.s.monetdb.36305" "--set" "monet_prompt="
"--forcemito"
"--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2017"
+# 16:03:47 >
+
+# 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:36305/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-2035/.s.monetdb.36305
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 16:03:47 >
+# 16:03:47 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-2035" "--port=36305"
+# 16:03:47 >
+
+#CREATE TABLE tab0(pk INTEGER PRIMARY KEY, col0 INTEGER, col1 FLOAT, col2
TEXT, col3 INTEGER, col4 FLOAT, col5 TEXT);
+#SELECT - col4 col0 FROM tab0 WHERE NOT NULL IS NULL;
+% sys.L2 # table_name
+% col0 # name
+% double # type
+% 24 # length
+#SELECT - ( + 13 ) col0 FROM tab0 WHERE NOT NULL IS NULL;
+% .L2 # table_name
+% col0 # name
+% tinyint # type
+% 1 # length
+#SELECT + col3 * 82 col3 FROM tab0 AS cor0 WHERE NULL IS NULL;
+% sys.L2 # table_name
+% col3 # name
+% bigint # type
+% 1 # length
+#SELECT DISTINCT + MAX ( DISTINCT - col1 ) col2 FROM tab0 WHERE - col3 + + 72
IS NULL;
+% sys.L4 # table_name
+% col2 # name
+% double # type
+% 24 # length
+[ NULL ]
+#DROP TABLE tab0;
+
+# 16:03:47 >
+# 16:03:47 > "Done."
+# 16:03:47 >
+
diff --git a/sql/test/BugTracker-2017/Tests/union_all_null.Bug-6487.sql
b/sql/test/BugTracker-2017/Tests/union_all_null.Bug-6487.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2017/Tests/union_all_null.Bug-6487.sql
@@ -0,0 +1,3 @@
+start transaction;
+CREATE TABLE g AS SELECT NULL AS j UNION ALL SELECT NULL AS j UNION ALL SELECT
'asdf' AS j WITH DATA;
+rollback;
diff --git a/sql/test/BugTracker-2017/Tests/union_all_null.Bug-6487.stable.err
b/sql/test/BugTracker-2017/Tests/union_all_null.Bug-6487.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2017/Tests/union_all_null.Bug-6487.stable.err
@@ -0,0 +1,34 @@
+stderr of test 'union_all_null.Bug-6487` in directory
'sql/test/BugTracker-2017` itself:
+
+
+# 16:03:48 >
+# 16:03:48 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=36305" "--set"
"mapi_usock=/var/tmp/mtest-2035/.s.monetdb.36305" "--set" "monet_prompt="
"--forcemito"
"--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2017"
+# 16:03:48 >
+
+# 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 = 36305
+# cmdline opt mapi_usock = /var/tmp/mtest-2035/.s.monetdb.36305
+# 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 = 553648138
+
+# 16:03:48 >
+# 16:03:48 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-2035" "--port=36305"
+# 16:03:48 >
+
+
+# 16:03:49 >
+# 16:03:49 > "Done."
+# 16:03:49 >
+
diff --git a/sql/test/BugTracker-2017/Tests/union_all_null.Bug-6487.stable.out
b/sql/test/BugTracker-2017/Tests/union_all_null.Bug-6487.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2017/Tests/union_all_null.Bug-6487.stable.out
@@ -0,0 +1,34 @@
+stdout of test 'union_all_null.Bug-6487` in directory
'sql/test/BugTracker-2017` itself:
+
+
+# 16:03:48 >
+# 16:03:48 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=36305" "--set"
"mapi_usock=/var/tmp/mtest-2035/.s.monetdb.36305" "--set" "monet_prompt="
"--forcemito"
"--dbpath=/home/niels/scratch/rc-monetdb/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2017"
+# 16:03:48 >
+
+# 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:36305/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-2035/.s.monetdb.36305
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+
+# 16:03:48 >
+# 16:03:48 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-2035" "--port=36305"
+# 16:03:48 >
+
+#start transaction;
+#CREATE TABLE g AS SELECT NULL AS j UNION ALL SELECT NULL AS j UNION ALL
SELECT 'asdf' AS j WITH DATA;
+#rollback;
+
+# 16:03:49 >
+# 16:03:49 > "Done."
+# 16:03:49 >
+
diff --git
a/sql/test/bugs/Tests/subselect_multiple_unionall_where_1=1-bug-sf-1005596.stable.out
b/sql/test/bugs/Tests/subselect_multiple_unionall_where_1=1-bug-sf-1005596.stable.out
---
a/sql/test/bugs/Tests/subselect_multiple_unionall_where_1=1-bug-sf-1005596.stable.out
+++
b/sql/test/bugs/Tests/subselect_multiple_unionall_where_1=1-bug-sf-1005596.stable.out
@@ -60,8 +60,8 @@ Ready.
[ 2 ]
% .tables, .tables, .tables, .tables, .tables,
.tables, .tables, .tables, .tables, .tables #
table_name
% TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, REMARKS,
TYPE_CAT, TYPE_SCHEM, TYPE_NAME, SELF_REFERENCING_COL_NAME,
REF_GENERATION # name
-% char, varchar, varchar, char, char, smallint,
smallint, smallint, char, char # type
-% 4, 0, 0, 20, 0, 1, 1, 1, 5, 6 #
length
+% char, varchar, varchar, char, char, char, char,
char, char, char # type
+% 4, 0, 0, 20, 0, 0, 0, 0, 5, 6 #
length
#SELECT 3 AS number;
% .L2 # table_name
% number # name
@@ -70,8 +70,8 @@ Ready.
[ 3 ]
% .tables, .tables, .tables, .tables, .tables,
.tables, .tables, .tables, .tables, .tables #
table_name
% TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, REMARKS,
TYPE_CAT, TYPE_SCHEM, TYPE_NAME, SELF_REFERENCING_COL_NAME,
REF_GENERATION # name
-% char, varchar, varchar, char, char, smallint,
smallint, smallint, char, char # type
-% 4, 3, 11, 20, 0, 1, 1, 1, 5, 6 #
length
+% char, varchar, varchar, char, char, char, char,
char, char, char # type
+% 4, 3, 11, 20, 0, 0, 0, 0, 5, 6 #
length
[ "demo", "sys", "test_update", "TABLE", "", NULL, NULL,
NULL, "rowid", "SYSTEM" ]
# 12:52:40 >
diff --git a/sql/test/bugs/Tests/union_all-bug-sf-941788.stable.out
b/sql/test/bugs/Tests/union_all-bug-sf-941788.stable.out
--- a/sql/test/bugs/Tests/union_all-bug-sf-941788.stable.out
+++ b/sql/test/bugs/Tests/union_all-bug-sf-941788.stable.out
@@ -26,8 +26,8 @@ Ready.
% .ttables, .ttables, .ttables, .ttables, .ttables,
.ttables, .ttables, .ttables, .ttables, .ttables #
table_name
% TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, REMARKS,
TYPE_CAT, TYPE_SCHEM, TYPE_NAME, SELF_REFERENCING_COL_NAME,
REF_GENERATION # name
-% smallint, varchar, varchar, char, char, smallint,
smallint, smallint, char, char # type
-% 1, 3, 9, 12, 0, 1, 1, 1, 2, 6 #
length
+% char, varchar, varchar, char, char, char, char,
char, char, char # type
+% 0, 3, 9, 12, 0, 0, 0, 0, 2, 6 #
length
[ NULL, "sys", "args", "SYSTEM TABLE", "", NULL, NULL, NULL,
"id", "SYSTEM" ]
[ NULL, "sys", "functions", "SYSTEM TABLE", "", NULL, NULL,
NULL, "id", "SYSTEM" ]
[ NULL, "sys", "idxs", "SYSTEM TABLE", "", NULL, NULL, NULL,
"id", "SYSTEM" ]
@@ -50,8 +50,8 @@ Ready.
# 'objects', 'key
% .ttables, .ttables, .ttables, .ttables, .ttables,
.ttables, .ttables, .ttables, .ttables, .ttables #
table_name
% TABLE_CAT, TABLE_SCHEM, TABLE_NAME, TABLE_TYPE, REMARKS,
TYPE_CAT, TYPE_SCHEM, TYPE_NAME, SELF_REFERENCING_COL_NAME,
REF_GENERATION # name
-% smallint, varchar, varchar, char, char, smallint,
smallint, smallint, char, char # type
-% 1, 3, 9, 23, 0, 1, 1, 1, 2, 6 #
length
+% char, varchar, varchar, char, char, char, char,
char, char, char # type
+% 0, 3, 9, 23, 0, 0, 0, 0, 2, 6 #
length
[ NULL, "sys", "args", "SYSTEM TABLE", "", NULL, NULL, NULL,
"id", "SYSTEM" ]
[ NULL, "sys", "functions", "SYSTEM TABLE", "", NULL, NULL,
NULL, "id", "SYSTEM" ]
[ NULL, "sys", "idxs", "SYSTEM TABLE", "", NULL, NULL, NULL,
"id", "SYSTEM" ]
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list