Changeset: 4b1fbafbd021 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/4b1fbafbd021 Modified Files: sql/backends/monet5/sql_statement.c sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.test Branch: default Log Message:
when converting a timestamp with tz into a time correctly adjust for local time diffs (60 lines): diff --git a/sql/backends/monet5/sql_statement.c b/sql/backends/monet5/sql_statement.c --- a/sql/backends/monet5/sql_statement.c +++ b/sql/backends/monet5/sql_statement.c @@ -3715,7 +3715,7 @@ temporal_convert(backend *be, stmt *v, s bool add_tz = false, pushed = (v->cand && v->cand == sel); if (before) { - if (f->type->eclass == EC_TIMESTAMP_TZ && t->type->eclass == EC_TIMESTAMP) { + if (f->type->eclass == EC_TIMESTAMP_TZ && (t->type->eclass == EC_TIMESTAMP || t->type->eclass == EC_TIME)) { /* call timestamp+local_timezone */ convert = "timestamp_add_msec_interval"; add_tz = true; @@ -3728,7 +3728,7 @@ temporal_convert(backend *be, stmt *v, s /* call timestamp+local_timezone */ convert = "timestamp_sub_msec_interval"; add_tz = true; - } else if (f->type->eclass == EC_TIME_TZ && t->type->eclass == EC_TIME) { + } else if (f->type->eclass == EC_TIME_TZ && (t->type->eclass == EC_TIME || t->type->eclass == EC_TIMESTAMP)) { /* call times+local_timezone */ convert = "time_add_msec_interval"; add_tz = true; diff --git a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.test b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.test --- a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.test +++ b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.test @@ -13776,13 +13776,13 @@ query TT rowsort SELECT v, convert(v, time) from T_timestamptz ---- 1999-12-31 23:59:59+02:00 -21:59:59 +23:59:59 2016-01-01 00:00:00+02:00 -22:00:00 +00:00:00 2016-02-29 00:00:00+02:00 -22:00:00 +00:00:00 2016-12-31 23:59:58+02:00 -21:59:58 +23:59:58 NULL NULL @@ -13977,13 +13977,13 @@ query TT rowsort SELECT v, cast(v as time) from T_timestamptz ---- 1999-12-31 23:59:59+02:00 -21:59:59 +23:59:59 2016-01-01 00:00:00+02:00 -22:00:00 +00:00:00 2016-02-29 00:00:00+02:00 -22:00:00 +00:00:00 2016-12-31 23:59:58+02:00 -21:59:58 +23:59:58 NULL NULL _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org