Changeset: c7375550b135 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c7375550b135 Added Files: sql/test/datetime/Tests/str_to_time.test Modified Files: monetdb5/modules/atoms/mtime.c sql/test/datetime/Tests/All Branch: mtime-bug Log Message:
Fixes str_to_time signature diffs (90 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 @@ -1799,8 +1799,8 @@ static mel_func mtime_init_funcs[] = { pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk_p1, false, "", args(1,4, batarg("",daytime),arg("s",str),batarg("format",str),arg("tz_msec",lng))), pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk_p2, false, "", args(1,4, batarg("",daytime),batarg("s",str),arg("format",str),arg("tz_msec",lng))), pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk, false, "", args(1,6, batarg("",daytime),batarg("s",str),batarg("format",str),batarg("s1",oid),batarg("s2",oid),arg("tz_msec",lng))), - pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk_p1, false, "", args(1,5, batarg("",daytime),arg("s",str),batarg("format",str),batarg("s",oid),arg("tz_msec",lng))), - pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk_p2, false, "", args(1,5, batarg("",daytime),batarg("s",str),arg("format",str),batarg("s",oid),arg("tz_msec",lng))), + pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk_p1, false, "", args(1,5, batarg("",daytime),arg("s",str),batarg("format",str),arg("tz_msec",lng),batarg("s",oid))), + pattern("batmtime", "str_to_time", MTIMEstr_to_time_bulk_p2, false, "", args(1,5, batarg("",daytime),batarg("s",str),arg("format",str),arg("tz_msec",lng),batarg("s",oid))), command("mtime", "time_to_str", MTIMEtime_to_str, false, "create a string from the time, using the specified format (see man strftime)", args(1,3, arg("",str),arg("d",daytime),arg("format",str))), pattern("batmtime", "time_to_str", MTIMEtime_to_str_bulk, false, "", args(1,3, batarg("",str),batarg("d",daytime),batarg("format",str))), pattern("batmtime", "time_to_str", MTIMEtime_to_str_bulk_p1, false, "", args(1,3, batarg("",str),arg("d",daytime),batarg("format",str))), diff --git a/sql/test/datetime/Tests/All b/sql/test/datetime/Tests/All --- a/sql/test/datetime/Tests/All +++ b/sql/test/datetime/Tests/All @@ -1,1 +1,2 @@ str_to_date +str_to_time diff --git a/sql/test/datetime/Tests/str_to_time.test b/sql/test/datetime/Tests/str_to_time.test new file mode 100644 --- /dev/null +++ b/sql/test/datetime/Tests/str_to_time.test @@ -0,0 +1,65 @@ +statement ok +create table itt (n int, t varchar(10), p varchar(10)) + +statement ok +insert into itt values + (1, '00:01:02', '%H:%M:%S'), + (2, '00:10:02', '%H:%S:%M'), + (3, '00:20:02', '%T') + +query IT rowsort +select n, str_to_time(t,'%H:%M:%S') from itt +---- +1 +00:01:02+01:00 +2 +00:10:02+01:00 +3 +00:20:02+01:00 + +# the CASE clause assures that we use a bat version of str_to_time which +# accept oid as arguments for the case of CASE condition (see the MAL) +query IT rowsort +select n, + case when n < 2 then + str_to_time(t,'%H:%M:%S') + else + str_to_time(t,'%H:%M:%S') + end +from itt +---- +1 +00:01:02+01:00 +2 +00:10:02+01:00 +3 +00:20:02+01:00 + +query IT rowsort +select n, str_to_time('00:12:34', p) from itt +---- +1 +00:12:34+01:00 +2 +00:34:12+01:00 +3 +00:12:34+01:00 + +# the CASE clause assures that we use a bat version of str_to_time which +# accept oid as arguments for the case of CASE condition (see the MAL) +query IT rowsort +select n, + case when n < 2 then + str_to_time('00:12:34',p) + else + str_to_time('00:12:34',p) + end +from itt +---- +1 +00:12:34+01:00 +2 +00:34:12+01:00 +3 +00:12:34+01:00 + _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org