Changeset: e7d28370aee7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e7d28370aee7
Added Files:
        sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.sql
        sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.stable.err
        sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.stable.out
Modified Files:
        sql/test/BugTracker-2019/Tests/All
Branch: Nov2019
Log Message:

Add test for Bug 6793


diffs (170 lines):

diff --git a/sql/test/BugTracker-2019/Tests/All 
b/sql/test/BugTracker-2019/Tests/All
--- a/sql/test/BugTracker-2019/Tests/All
+++ b/sql/test/BugTracker-2019/Tests/All
@@ -51,3 +51,4 @@ isaUUID.Bug-6784
 count-distinct.Bug-6790
 str_to_time.Bug-6791
 jsonpath-validity.Bug-6792
+cast-interval.Bug-6793
diff --git a/sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.sql 
b/sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.sql
@@ -0,0 +1,20 @@
+CREATE TABLE INTERVAL_TBL (f1 interval second);
+INSERT INTO INTERVAL_TBL (f1) VALUES (1.123);
+INSERT INTO INTERVAL_TBL (f1) VALUES (2.123);
+INSERT INTO INTERVAL_TBL (f1) VALUES (3.123);
+INSERT INTO INTERVAL_TBL (f1) VALUES (4.123);
+SELECT f1, cast(f1 as int), cast(f1 as dec(8,3)), cast(f1 as real) FROM 
INTERVAL_TBL;
+SELECT count(f1), sum(f1), cast(sum(f1) as int), cast(sum(f1) as dec(8,3)), 
cast(sum(f1) as real) FROM INTERVAL_TBL;
+DROP TABLE INTERVAL_TBL;
+
+CREATE TABLE INTERVAL_TBL (f1 interval month);
+INSERT INTO INTERVAL_TBL (f1) VALUES (1);
+INSERT INTO INTERVAL_TBL (f1) VALUES (2);
+INSERT INTO INTERVAL_TBL (f1) VALUES (3);
+INSERT INTO INTERVAL_TBL (f1) VALUES (4);
+SELECT f1, cast(f1 as int) FROM INTERVAL_TBL;
+SELECT f1, cast(f1 as dec(3,0)) FROM INTERVAL_TBL;  -- returns error: types 
month_interval(3,0) and decimal(3,0) are not equal for column 'f1'
+SELECT f1, cast(f1 as real) FROM INTERVAL_TBL;  --  returns error: types 
month_interval(3,0) and real(24,0) are not equal for column 'f1'
+SELECT count(f1), sum(f1), cast(sum(f1) as int), cast(sum(f1) as dec(8,3)), 
cast(sum(f1) as real) FROM INTERVAL_TBL;
+DROP TABLE INTERVAL_TBL;
+
diff --git a/sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.stable.err 
b/sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.stable.err
@@ -0,0 +1,30 @@
+stderr of test 'cast-interval.Bug-6793` in directory 
'sql/test/BugTracker-2019` itself:
+
+
+# 13:25:35 >  
+# 13:25:35 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=33951" "--set" 
"mapi_usock=/var/tmp/mtest-5984/.s.monetdb.33951" "--forcemito" 
"--dbpath=/home/dinther/dev/dev/INSTALL/var/MonetDB/mTests_sql_test_BugTracker-2019"
 "--set" "embedded_c=true"
+# 13:25:35 >  
+
+# builtin opt  gdk_dbpath = 
/home/dinther/dev/dev/INSTALL/var/monetdb5/dbfarm/demo
+# builtin opt  mapi_port = 50000
+# builtin opt  mapi_open = false
+# builtin opt  mapi_ipv6 = 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 = 33951
+# cmdline opt  mapi_usock = /var/tmp/mtest-5984/.s.monetdb.33951
+# cmdline opt  gdk_dbpath = 
/home/dinther/dev/dev/INSTALL/var/MonetDB/mTests_sql_test_BugTracker-2019
+# cmdline opt  embedded_c = true
+
+# 13:25:36 >  
+# 13:25:36 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-5984" "--port=33951"
+# 13:25:36 >  
+
+
+# 13:25:36 >  
+# 13:25:36 >  "Done."
+# 13:25:36 >  
+
diff --git a/sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.stable.out 
b/sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2019/Tests/cast-interval.Bug-6793.stable.out
@@ -0,0 +1,97 @@
+stdout of test 'cast-interval.Bug-6793` in directory 
'sql/test/BugTracker-2019` itself:
+
+
+# 13:25:35 >  
+# 13:25:35 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=33951" "--set" 
"mapi_usock=/var/tmp/mtest-5984/.s.monetdb.33951" "--forcemito" 
"--dbpath=/home/dinther/dev/dev/INSTALL/var/MonetDB/mTests_sql_test_BugTracker-2019"
 "--set" "embedded_c=true"
+# 13:25:35 >  
+
+# MonetDB 5 server v11.35.4 (hg id: e54cc7e9164a)
+# This is an unreleased version
+# Serving database 'mTests_sql_test_BugTracker-2019', using 8 threads
+# Compiled for x86_64-pc-linux-gnu/64bit with 128bit integers
+# Found 31.243 GiB available main-memory of which we use 25.463 GiB
+# Copyright (c) 1993 - July 2008 CWI.
+# Copyright (c) August 2008 - 2019 MonetDB B.V., all rights reserved
+# Visit https://www.monetdb.org/ for further information
+# Listening for connection requests on 
mapi:monetdb://localhost.localdomain:33951/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-5984/.s.monetdb.33951
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+
+# 13:25:36 >  
+# 13:25:36 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-5984" "--port=33951"
+# 13:25:36 >  
+
+#CREATE TABLE INTERVAL_TBL (f1 interval second);
+#INSERT INTO INTERVAL_TBL (f1) VALUES (1.123);
+[ 1    ]
+#INSERT INTO INTERVAL_TBL (f1) VALUES (2.123);
+[ 1    ]
+#INSERT INTO INTERVAL_TBL (f1) VALUES (3.123);
+[ 1    ]
+#INSERT INTO INTERVAL_TBL (f1) VALUES (4.123);
+[ 1    ]
+#SELECT f1, cast(f1 as int), cast(f1 as dec(8,3)), cast(f1 as real) FROM 
INTERVAL_TBL;
+% sys.interval_tbl,    sys.L1, sys.L2, sys.L3 # table_name
+% f1,  L1,     L2,     L3 # name
+% sec_interval,        int,    decimal,        real # type
+% 5,   1,      10,     15 # length
+[ 1.123,       1,      1.123,  1.123   ]
+[ 2.123,       2,      2.123,  2.123   ]
+[ 3.123,       3,      3.123,  3.123   ]
+[ 4.123,       4,      4.123,  4.123   ]
+#SELECT count(f1), sum(f1), cast(sum(f1) as int), cast(sum(f1) as dec(8,3)), 
cast(sum(f1) as real) FROM INTERVAL_TBL;
+% sys.L2,      sys.L3, sys.L5, sys.L7, sys.L11 # table_name
+% L2,  L3,     L5,     L7,     L11 # name
+% bigint,      sec_interval,   int,    decimal,        real # type
+% 1,   6,      2,      10,     15 # length
+[ 4,   10.492, 10,     10.492, 10.492  ]
+#DROP TABLE INTERVAL_TBL;
+#CREATE TABLE INTERVAL_TBL (f1 interval month);
+#INSERT INTO INTERVAL_TBL (f1) VALUES (1);
+[ 1    ]
+#INSERT INTO INTERVAL_TBL (f1) VALUES (2);
+[ 1    ]
+#INSERT INTO INTERVAL_TBL (f1) VALUES (3);
+[ 1    ]
+#INSERT INTO INTERVAL_TBL (f1) VALUES (4);
+[ 1    ]
+#SELECT f1, cast(f1 as int) FROM INTERVAL_TBL;
+% sys.interval_tbl,    sys.L1 # table_name
+% f1,  L1 # name
+% month_interval,      int # type
+% 1,   1 # length
+[ 1,   1       ]
+[ 2,   2       ]
+[ 3,   3       ]
+[ 4,   4       ]
+#SELECT f1, cast(f1 as dec(3,0)) FROM INTERVAL_TBL;
+% sys.interval_tbl,    sys.L1 # table_name
+% f1,  L1 # name
+% month_interval,      decimal # type
+% 1,   5 # length
+[ 1,   1       ]
+[ 2,   2       ]
+[ 3,   3       ]
+[ 4,   4       ]
+#SELECT f1, cast(f1 as real) FROM INTERVAL_TBL;
+% sys.interval_tbl,    sys.L1 # table_name
+% f1,  L1 # name
+% month_interval,      real # type
+% 1,   15 # length
+[ 1,   1       ]
+[ 2,   2       ]
+[ 3,   3       ]
+[ 4,   4       ]
+#SELECT count(f1), sum(f1), cast(sum(f1) as int), cast(sum(f1) as dec(8,3)), 
cast(sum(f1) as real) FROM INTERVAL_TBL;
+% sys.L2,      sys.L3, sys.L5, sys.L7, sys.L11 # table_name
+% L2,  L3,     L5,     L7,     L11 # name
+% bigint,      month_interval, int,    decimal,        real # type
+% 1,   2,      2,      10,     15 # length
+[ 4,   10,     10,     10.000, 10.000  ]
+#DROP TABLE INTERVAL_TBL;
+
+# 13:25:36 >  
+# 13:25:36 >  "Done."
+# 13:25:36 >  
+
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to