Changeset: a29c98d5069d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a29c98d5069d Added Files: sql/test/BugTracker-2019/Tests/str_to_time.Bug-6791.sql sql/test/BugTracker-2019/Tests/str_to_time.Bug-6791.stable.err sql/test/BugTracker-2019/Tests/str_to_time.Bug-6791.stable.out Modified Files: monetdb5/modules/atoms/mtime.c sql/test/BugTracker-2014/Tests/aggregates-intervals.Bug-3533.stable.out sql/test/BugTracker-2019/Tests/All Branch: default Log Message:
Merge with Nov2019 diffs (260 lines): diff --git a/monetdb5/modules/atoms/mtime.c b/monetdb5/modules/atoms/mtime.c --- a/monetdb5/modules/atoms/mtime.c +++ b/monetdb5/modules/atoms/mtime.c @@ -342,7 +342,7 @@ static MT_Lock timelock = MT_LOCK_INITIA timestamp timestamp_fromtime(time_t timeval) { - struct tm tm, *tmp; + struct tm tm = (struct tm) {0}, *tmp; date d; daytime t; @@ -1705,7 +1705,7 @@ MTIMElocal_timezone_msec(lng *ret) #else time_t t; timestamp lt, gt; - struct tm tm, *tmp; + struct tm tm = (struct tm) {0}, *tmp; t = time(NULL); #ifdef HAVE_GMTIME_R @@ -1755,6 +1755,7 @@ MTIMEstr_to_date(date *ret, const char * *ret = date_nil; return MAL_SUCCEED; } + tm = (struct tm) {0}; if (strptime(*s, *format, &tm) == NULL) throw(MAL, "mtime.str_to_date", "format '%s', doesn't match date '%s'", *format, *s); @@ -1801,6 +1802,7 @@ MTIMEstr_to_time(daytime *ret, const cha *ret = daytime_nil; return MAL_SUCCEED; } + tm = (struct tm) {0}; if (strptime(*s, *format, &tm) == NULL) throw(MAL, "mtime.str_to_time", "format '%s', doesn't match time '%s'", *format, *s); @@ -1824,6 +1826,7 @@ MTIMEtime_to_str(str *ret, const daytime return MAL_SUCCEED; } time_t now = time(NULL); + tm = (struct tm) {0}; /* fill in current date in struct tm */ #ifdef HAVE_LOCALTIME_R localtime_r(&now, &tm); @@ -1852,12 +1855,13 @@ MTIMEtime_to_str(str *ret, const daytime str MTIMEstr_to_timestamp(timestamp *ret, const char *const *s, const char *const *format) { - struct tm tm = (struct tm) {0}; + struct tm tm; if (GDK_STRNIL(*s) || GDK_STRNIL(*format)) { *ret = timestamp_nil; return MAL_SUCCEED; } + tm = (struct tm) {0}; if (strptime(*s, *format, &tm) == NULL) throw(MAL, "mtime.str_to_timestamp", "format '%s', doesn't match timestamp '%s'", *format, *s); diff --git a/sql/test/BugTracker-2014/Tests/aggregates-intervals.Bug-3533.stable.out b/sql/test/BugTracker-2014/Tests/aggregates-intervals.Bug-3533.stable.out --- a/sql/test/BugTracker-2014/Tests/aggregates-intervals.Bug-3533.stable.out +++ b/sql/test/BugTracker-2014/Tests/aggregates-intervals.Bug-3533.stable.out @@ -17,45 +17,6 @@ stdout of test 'aggregates-intervals.Bug # Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-284678/.s.monetdb.34676 # MonetDB/GIS module loaded # SQL catalog created, loading sql scripts once -# loading sql script: 09_like.sql -# loading sql script: 10_math.sql -# loading sql script: 12_url.sql -# loading sql script: 13_date.sql -# loading sql script: 14_inet.sql -# loading sql script: 15_querylog.sql -# loading sql script: 16_tracelog.sql -# loading sql script: 17_temporal.sql -# loading sql script: 18_index.sql -# loading sql script: 20_vacuum.sql -# loading sql script: 21_dependency_views.sql -# loading sql script: 22_clients.sql -# loading sql script: 23_skyserver.sql -# loading sql script: 25_debug.sql -# loading sql script: 26_sysmon.sql -# loading sql script: 27_rejects.sql -# loading sql script: 39_analytics.sql -# loading sql script: 39_analytics_hge.sql -# loading sql script: 40_geom.sql -# loading sql script: 40_json.sql -# loading sql script: 40_json_hge.sql -# loading sql script: 41_md5sum.sql -# loading sql script: 45_uuid.sql -# loading sql script: 46_profiler.sql -# loading sql script: 51_sys_schema_extension.sql -# loading sql script: 60_wlcr.sql -# loading sql script: 61_wlcr.sql -# loading sql script: 72_fits.sql -# loading sql script: 74_netcdf.sql -# loading sql script: 75_lidar.sql -# loading sql script: 75_shp.sql -# loading sql script: 75_storagemodel.sql -# loading sql script: 80_statistics.sql -# loading sql script: 80_udf.sql -# loading sql script: 80_udf_hge.sql -# loading sql script: 85_bam.sql -# loading sql script: 90_generator.sql -# loading sql script: 90_generator_hge.sql -# loading sql script: 99_system.sql # MonetDB/SQL module loaded # 16:49:00 > @@ -70,8 +31,8 @@ stdout of test 'aggregates-intervals.Bug % sys.%1, sys.%3, sys.%4, sys.%5, sys.%6, sys.%7 # table_name % %1, %3, %4, %5, %6, %7 # name % bigint, bigint, double, sec_interval, sec_interval, sec_interval # type -% 1, 5, 24, 5, 5, 5 # length -[ 4, 10000, 2.5, 2.000, 4.000, 1.000 ] +% 1, 2, 24, 5, 5, 5 # length +[ 4, 10, 2.5, 2.000, 4.000, 1.000 ] #CREATE TABLE INTERVAL_TBL2 (f1 interval month); #INSERT INTO INTERVAL_TBL2 (f1) VALUES (1), (2), (3), (4); [ 4 ] 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 @@ -49,4 +49,5 @@ index-insert-crash.Bug-6781 avg-changes-value-scale.Bug-6783 isaUUID.Bug-6784 count-distinct.Bug-6790 +str_to_time.Bug-6791 jsonpath-validity.Bug-6792 diff --git a/sql/test/BugTracker-2019/Tests/str_to_time.Bug-6791.sql b/sql/test/BugTracker-2019/Tests/str_to_time.Bug-6791.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2019/Tests/str_to_time.Bug-6791.sql @@ -0,0 +1,7 @@ +SELECT str_to_date('23-09-1987', '%d-%m-%Y') AS "date", + str_to_time('11:40', '%H:%M') AS "time", + str_to_timestamp('23-09-1987 11:40', '%d-%m-%Y %H:%M') AS "timestamp"; + +EXPLAIN SELECT str_to_date('23-09-1987', '%d-%m-%Y') AS "date", + str_to_time('11:40', '%H:%M') AS "time", + str_to_timestamp('23-09-1987 11:40', '%d-%m-%Y %H:%M') AS "timestamp"; diff --git a/sql/test/BugTracker-2019/Tests/str_to_time.Bug-6791.stable.err b/sql/test/BugTracker-2019/Tests/str_to_time.Bug-6791.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2019/Tests/str_to_time.Bug-6791.stable.err @@ -0,0 +1,30 @@ +stderr of test 'str_to_time.Bug-6791` in directory 'sql/test/BugTracker-2019` itself: + + +# 17:30:27 > +# 17:30:27 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=35094" "--set" "mapi_usock=/var/tmp/mtest-17372/.s.monetdb.35094" "--forcemito" "--dbpath=/home/dinther/dev/dev/INSTALL/var/MonetDB/mTests_sql_test_BugTracker-2019" "--set" "embedded_c=true" +# 17:30:27 > + +# 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 = 35094 +# cmdline opt mapi_usock = /var/tmp/mtest-17372/.s.monetdb.35094 +# cmdline opt gdk_dbpath = /home/dinther/dev/dev/INSTALL/var/MonetDB/mTests_sql_test_BugTracker-2019 +# cmdline opt embedded_c = true + +# 17:30:27 > +# 17:30:27 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-17372" "--port=35094" +# 17:30:27 > + + +# 17:30:27 > +# 17:30:27 > "Done." +# 17:30:27 > + diff --git a/sql/test/BugTracker-2019/Tests/str_to_time.Bug-6791.stable.out b/sql/test/BugTracker-2019/Tests/str_to_time.Bug-6791.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2019/Tests/str_to_time.Bug-6791.stable.out @@ -0,0 +1,79 @@ +stdout of test 'str_to_time.Bug-6791` in directory 'sql/test/BugTracker-2019` itself: + + +# 17:30:27 > +# 17:30:27 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=35094" "--set" "mapi_usock=/var/tmp/mtest-17372/.s.monetdb.35094" "--forcemito" "--dbpath=/home/dinther/dev/dev/INSTALL/var/MonetDB/mTests_sql_test_BugTracker-2019" "--set" "embedded_c=true" +# 17:30:27 > + +# MonetDB 5 server v11.35.4 (hg id: 53f7286e297d) +# 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:35094/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-17372/.s.monetdb.35094 +# MonetDB/GIS module loaded +# MonetDB/SQL module loaded + +# 17:30:27 > +# 17:30:27 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-17372" "--port=35094" +# 17:30:27 > + +#SELECT str_to_date('23-09-1987', '%d-%m-%Y') AS "date", +# str_to_time('11:40', '%H:%M') AS "time", +# str_to_timestamp('23-09-1987 11:40', '%d-%m-%Y %H:%M') AS "timestamp"; +% .%1, .%2, .%3 # table_name +% date, time, timestamp # name +% date, time, timestamp # type +% 10, 8, 26 # length +[ 1987-09-23, 11:40:00, 1987-09-23 11:40:00.000000 ] +#EXPLAIN SELECT str_to_date('23-09-1987', '%d-%m-%Y') AS "date", +# str_to_time('11:40', '%H:%M') AS "time", +# str_to_timestamp('23-09-1987 11:40', '%d-%m-%Y %H:%M') AS "timestamp"; +% .explain # table_name +% mal # name +% clob # type +% 269 # length +function user.s2_0():void; + X_7:void := querylog.define("select str_to_date(\\'23-09-1987\\', \\'%d-%m-%Y\\') as \"date\",\n str_to_time(\\'11:40\\', \\'%H:%M\\') as \"time\",\n str_to_timestamp(\\'23-09-1987 11:40\\', \\'%d-%m-%Y %H:%M\\') as \"timestamp\";":str, "default_pipe":str, 20:int); + X_23:bat[:str] := bat.pack(".%1":str, ".%2":str, ".%3":str); + X_24:bat[:str] := bat.pack("date":str, "time":str, "timestamp":str); + X_26:bat[:int] := bat.pack(0:int, 1:int, 7:int); + X_27:bat[:int] := bat.pack(0:int, 0:int, 0:int); + sql.resultSet(X_23:bat[:str], X_24:bat[:str], X_24:bat[:str], X_26:bat[:int], X_27:bat[:int], "1987-09-23":date, "11:40:00.000000":daytime, "1987-09-23 11:40:00.000000":timestamp); +end user.s2_0; +# optimizer.mitosis() +# optimizer.dataflow() +#inline actions= 0 time=1 usec +#remap actions= 0 time=1 usec +#costmodel actions= 1 time=2 usec +#coercion actions= 0 time=2 usec +#aliases actions= 6 time=5 usec +#evaluate actions= 3 time=18 usec +#emptybind actions= 0 time=0 usec +#pushselect actions= 0 time=4 usec +#aliases actions= 3 time=4 usec +#mergetable actions= 0 time=24 usec +#deadcode actions= 1 time=7 usec +#aliases actions= 0 time=0 usec +#constants actions= 0 time=6 usec +#commonTerms actions= 0 time=2 usec +#projectionpath actions= 0 time=2 usec +#deadcode actions= 0 time=5 usec +#reorder actions= 1 time=17 usec +#matpack actions= 0 time=1 usec +#multiplex actions= 0 time=2 usec +#profiler actions= 1 time=1 usec +#candidates actions= 1 time=1 usec +#deadcode actions= 0 time=5 usec +#wlc actions= 0 time=0 usec +#garbagecollector actions= 1 time=36 usec +#total actions=27 time=221 usec + +# 17:30:27 > +# 17:30:27 > "Done." +# 17:30:27 > + _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list