Changeset: debc832810a6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=debc832810a6
Modified Files:
sql/backends/monet5/sql_statement.c
sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
Branch: Apr2019
Log Message:
We need to actually convert if source and destination differ in having time
zone.
diffs (200 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
@@ -2724,7 +2724,13 @@ stmt_convert(backend *be, stmt *v, sql_s
if (v->nr < 0)
return NULL;
- if (t->type->localtype == f->type->localtype && (t->type->eclass ==
f->type->eclass || (EC_VARCHAR(f->type->eclass) &&
EC_VARCHAR(t->type->eclass))) && !EC_INTERVAL(f->type->eclass) &&
f->type->eclass != EC_DEC && (t->digits == 0 || f->digits == t->digits)) {
+ if (t->type->localtype == f->type->localtype &&
+ (t->type->eclass == f->type->eclass ||
+ (EC_VARCHAR(f->type->eclass) && EC_VARCHAR(t->type->eclass))) &&
+ !EC_INTERVAL(f->type->eclass) &&
+ f->type->eclass != EC_DEC &&
+ (t->digits == 0 || f->digits == t->digits) &&
+ type_has_tz(t) == type_has_tz(f)) {
return v;
}
diff --git
a/sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
b/sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
---
a/sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
+++
b/sql/test/BugTracker-2016/Tests/convert-function-test-hge.Bug-3460.stable.out.int128
@@ -16,10 +16,6 @@ stdout of test 'convert-function-test-hg
# Listening for connection requests on mapi:monetdb://toulouse.da.cwi.nl:36439/
# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-11655/.s.monetdb.36439
# MonetDB/GIS module loaded
-# MonetDB/SQL module loaded
-# MonetDB/R module loaded
-
-Ready.
# SQL catalog created, loading sql scripts once
# loading sql script: 09_like.sql
# loading sql script: 10_math.sql
@@ -59,6 +55,9 @@ Ready.
# loading sql script: 90_generator.sql
# loading sql script: 90_generator_hge.sql
# loading sql script: 99_system.sql
+# MonetDB/SQL module loaded
+
+Ready.
# 19:15:22 >
# 19:15:22 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-11655" "--port=36439"
diff --git
a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
--- a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
+++ b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
@@ -6864,12 +6864,12 @@ Ready.
#SELECT v, convert(v, timestamptz) from T_timestamp;
% sys.t_timestamp, sys.L3 # table_name
% v, L3 # name
-% timestamp, timestamp # type
-% 26, 26 # length
-[ 1999-12-31 23:59:59.000000, 1999-12-31 23:59:59.000000 ]
-[ 2016-01-01 00:00:00.000000, 2016-01-01 00:00:00.000000 ]
-[ 2016-02-29 00:00:00.000000, 2016-02-29 00:00:00.000000 ]
-[ 2016-12-31 23:59:58.000000, 2016-12-31 23:59:58.000000 ]
+% timestamp, timestamptz # type
+% 26, 32 # length
+[ 1999-12-31 23:59:59.000000, 2000-01-01 01:59:59.000000+02:00 ]
+[ 2016-01-01 00:00:00.000000, 2016-01-01 02:00:00.000000+02:00 ]
+[ 2016-02-29 00:00:00.000000, 2016-02-29 02:00:00.000000+02:00 ]
+[ 2016-12-31 23:59:58.000000, 2017-01-01 01:59:58.000000+02:00 ]
[ NULL, NULL ]
#SELECT v, cast(v as varchar(36)) from T_timestamp;
% sys.t_timestamp, sys.L3 # table_name
@@ -6944,12 +6944,12 @@ Ready.
#SELECT v, cast(v as timestamptz) from T_timestamp;
% sys.t_timestamp, sys.L3 # table_name
% v, L3 # name
-% timestamp, timestamp # type
-% 26, 26 # length
-[ 1999-12-31 23:59:59.000000, 1999-12-31 23:59:59.000000 ]
-[ 2016-01-01 00:00:00.000000, 2016-01-01 00:00:00.000000 ]
-[ 2016-02-29 00:00:00.000000, 2016-02-29 00:00:00.000000 ]
-[ 2016-12-31 23:59:58.000000, 2016-12-31 23:59:58.000000 ]
+% timestamp, timestamptz # type
+% 26, 32 # length
+[ 1999-12-31 23:59:59.000000, 2000-01-01 01:59:59.000000+02:00 ]
+[ 2016-01-01 00:00:00.000000, 2016-01-01 02:00:00.000000+02:00 ]
+[ 2016-02-29 00:00:00.000000, 2016-02-29 02:00:00.000000+02:00 ]
+[ 2016-12-31 23:59:58.000000, 2017-01-01 01:59:58.000000+02:00 ]
[ NULL, NULL ]
#DROP TABLE T_timestamp;
#CREATE TABLE T_timetz (v TIMETZ);
@@ -7114,12 +7114,12 @@ Ready.
#SELECT v, convert(v, timestamp) from T_timestamptz;
% sys.t_timestamptz, sys.L3 # table_name
% v, L3 # name
-% timestamptz, timestamptz # type
-% 32, 32 # length
-[ 2000-01-01 01:59:59.000000+02:00, 2000-01-01 01:59:59.000000+02:00
]
-[ 2016-01-01 02:00:00.000000+02:00, 2016-01-01 02:00:00.000000+02:00
]
-[ 2016-02-29 02:00:00.000000+02:00, 2016-02-29 02:00:00.000000+02:00
]
-[ 2017-01-01 01:59:58.000000+02:00, 2017-01-01 01:59:58.000000+02:00
]
+% timestamptz, timestamp # type
+% 32, 26 # length
+[ 2000-01-01 01:59:59.000000+02:00, 1999-12-31 23:59:59.000000 ]
+[ 2016-01-01 02:00:00.000000+02:00, 2016-01-01 00:00:00.000000 ]
+[ 2016-02-29 02:00:00.000000+02:00, 2016-02-29 00:00:00.000000 ]
+[ 2017-01-01 01:59:58.000000+02:00, 2016-12-31 23:59:58.000000 ]
[ NULL, NULL ]
#SELECT v, convert(v, timetz) from T_timestamptz;
% sys.t_timestamptz, sys.L3 # table_name
@@ -7194,12 +7194,12 @@ Ready.
#SELECT v, cast(v as timestamp) from T_timestamptz;
% sys.t_timestamptz, sys.L3 # table_name
% v, L3 # name
-% timestamptz, timestamptz # type
-% 32, 32 # length
-[ 2000-01-01 01:59:59.000000+02:00, 2000-01-01 01:59:59.000000+02:00
]
-[ 2016-01-01 02:00:00.000000+02:00, 2016-01-01 02:00:00.000000+02:00
]
-[ 2016-02-29 02:00:00.000000+02:00, 2016-02-29 02:00:00.000000+02:00
]
-[ 2017-01-01 01:59:58.000000+02:00, 2017-01-01 01:59:58.000000+02:00
]
+% timestamptz, timestamp # type
+% 32, 26 # length
+[ 2000-01-01 01:59:59.000000+02:00, 1999-12-31 23:59:59.000000 ]
+[ 2016-01-01 02:00:00.000000+02:00, 2016-01-01 00:00:00.000000 ]
+[ 2016-02-29 02:00:00.000000+02:00, 2016-02-29 00:00:00.000000 ]
+[ 2017-01-01 01:59:58.000000+02:00, 2016-12-31 23:59:58.000000 ]
[ NULL, NULL ]
#SELECT v, cast(v as timetz) from T_timestamptz;
% sys.t_timestamptz, sys.L3 # table_name
diff --git
a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
---
a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
+++
b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
@@ -7204,12 +7204,12 @@ Ready.
#SELECT v, convert(v, timestamptz) from T_timestamp;
% sys.t_timestamp, sys.L3 # table_name
% v, L3 # name
-% timestamp, timestamp # type
-% 26, 26 # length
-[ 1999-12-31 23:59:59.000000, 1999-12-31 23:59:59.000000 ]
-[ 2016-01-01 00:00:00.000000, 2016-01-01 00:00:00.000000 ]
-[ 2016-02-29 00:00:00.000000, 2016-02-29 00:00:00.000000 ]
-[ 2016-12-31 23:59:58.000000, 2016-12-31 23:59:58.000000 ]
+% timestamp, timestamptz # type
+% 26, 32 # length
+[ 1999-12-31 23:59:59.000000, 2000-01-01 01:59:59.000000+02:00 ]
+[ 2016-01-01 00:00:00.000000, 2016-01-01 02:00:00.000000+02:00 ]
+[ 2016-02-29 00:00:00.000000, 2016-02-29 02:00:00.000000+02:00 ]
+[ 2016-12-31 23:59:58.000000, 2017-01-01 01:59:58.000000+02:00 ]
[ NULL, NULL ]
#SELECT v, cast(v as varchar(36)) from T_timestamp;
% sys.t_timestamp, sys.L3 # table_name
@@ -7284,12 +7284,12 @@ Ready.
#SELECT v, cast(v as timestamptz) from T_timestamp;
% sys.t_timestamp, sys.L3 # table_name
% v, L3 # name
-% timestamp, timestamp # type
-% 26, 26 # length
-[ 1999-12-31 23:59:59.000000, 1999-12-31 23:59:59.000000 ]
-[ 2016-01-01 00:00:00.000000, 2016-01-01 00:00:00.000000 ]
-[ 2016-02-29 00:00:00.000000, 2016-02-29 00:00:00.000000 ]
-[ 2016-12-31 23:59:58.000000, 2016-12-31 23:59:58.000000 ]
+% timestamp, timestamptz # type
+% 26, 32 # length
+[ 1999-12-31 23:59:59.000000, 2000-01-01 01:59:59.000000+02:00 ]
+[ 2016-01-01 00:00:00.000000, 2016-01-01 02:00:00.000000+02:00 ]
+[ 2016-02-29 00:00:00.000000, 2016-02-29 02:00:00.000000+02:00 ]
+[ 2016-12-31 23:59:58.000000, 2017-01-01 01:59:58.000000+02:00 ]
[ NULL, NULL ]
#DROP TABLE T_timestamp;
#CREATE TABLE T_timetz (v TIMETZ);
@@ -7454,12 +7454,12 @@ Ready.
#SELECT v, convert(v, timestamp) from T_timestamptz;
% sys.t_timestamptz, sys.L3 # table_name
% v, L3 # name
-% timestamptz, timestamptz # type
-% 32, 32 # length
-[ 2000-01-01 01:59:59.000000+02:00, 2000-01-01 01:59:59.000000+02:00
]
-[ 2016-01-01 02:00:00.000000+02:00, 2016-01-01 02:00:00.000000+02:00
]
-[ 2016-02-29 02:00:00.000000+02:00, 2016-02-29 02:00:00.000000+02:00
]
-[ 2017-01-01 01:59:58.000000+02:00, 2017-01-01 01:59:58.000000+02:00
]
+% timestamptz, timestamp # type
+% 32, 26 # length
+[ 2000-01-01 01:59:59.000000+02:00, 1999-12-31 23:59:59.000000 ]
+[ 2016-01-01 02:00:00.000000+02:00, 2016-01-01 00:00:00.000000 ]
+[ 2016-02-29 02:00:00.000000+02:00, 2016-02-29 00:00:00.000000 ]
+[ 2017-01-01 01:59:58.000000+02:00, 2016-12-31 23:59:58.000000 ]
[ NULL, NULL ]
#SELECT v, convert(v, timetz) from T_timestamptz;
% sys.t_timestamptz, sys.L3 # table_name
@@ -7534,12 +7534,12 @@ Ready.
#SELECT v, cast(v as timestamp) from T_timestamptz;
% sys.t_timestamptz, sys.L3 # table_name
% v, L3 # name
-% timestamptz, timestamptz # type
-% 32, 32 # length
-[ 2000-01-01 01:59:59.000000+02:00, 2000-01-01 01:59:59.000000+02:00
]
-[ 2016-01-01 02:00:00.000000+02:00, 2016-01-01 02:00:00.000000+02:00
]
-[ 2016-02-29 02:00:00.000000+02:00, 2016-02-29 02:00:00.000000+02:00
]
-[ 2017-01-01 01:59:58.000000+02:00, 2017-01-01 01:59:58.000000+02:00
]
+% timestamptz, timestamp # type
+% 32, 26 # length
+[ 2000-01-01 01:59:59.000000+02:00, 1999-12-31 23:59:59.000000 ]
+[ 2016-01-01 02:00:00.000000+02:00, 2016-01-01 00:00:00.000000 ]
+[ 2016-02-29 02:00:00.000000+02:00, 2016-02-29 00:00:00.000000 ]
+[ 2017-01-01 01:59:58.000000+02:00, 2016-12-31 23:59:58.000000 ]
[ NULL, NULL ]
#SELECT v, cast(v as timetz) from T_timestamptz;
% sys.t_timestamptz, sys.L3 # table_name
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list