summaryrefslogtreecommitdiff
path: root/sql/field_conv.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-09-21 21:21:36 +0200
committerSergei Golubchik <serg@mariadb.org>2017-09-22 14:01:26 +0200
commit68d1a598bcda36d375fd295e3e65cdf8aef027f1 (patch)
treeca6ea610a74af81bbfbc256f0670e9c16f647d6a /sql/field_conv.cc
parenta5e1f60b3167e0057e64166df06424f1fb96bec3 (diff)
downloadmariadb-git-68d1a598bcda36d375fd295e3e65cdf8aef027f1.tar.gz
bugfix: copy timestamps correctly in INSERT...SELECT
Implement Field_timestamp::save_in_field(timestamp_field) that stores timestamp values without converting them to MYSQL_TIME and back, because this conversion is lossy around DST change time. This fixes main.old-mode test. This is 10.2 version of f8a800bec81
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r--sql/field_conv.cc7
1 files changed, 2 insertions, 5 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 15df2c398a3..c3ad0c878b5 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -419,11 +419,8 @@ void Field::do_field_decimal(Copy_field *copy)
void Field::do_field_timestamp(Copy_field *copy)
{
- Field_timestamp *f= static_cast<Field_timestamp*>(copy->from_field);
- Field_timestamp *t= static_cast<Field_timestamp*>(copy->to_field);
- ulong sec_part;
- my_time_t ts= f->get_timestamp(&sec_part);
- t->store_TIME(ts, sec_part);
+ // XXX why couldn't we do it everywhere?
+ copy->from_field->save_in_field(copy->to_field);
}