summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2014-04-18 12:19:51 +0400
committerAlexander Barkov <bar@mnogosearch.org>2014-04-18 12:19:51 +0400
commit8db600f951005b0b23b23dcd0ddd848303aa13ac (patch)
tree48a761aeab9aaeaecf6232407e65dc97962c8375 /sql/field.cc
parent13dc299a4fa50627aff42480c8e995347283e475 (diff)
downloadmariadb-git-8db600f951005b0b23b23dcd0ddd848303aa13ac.tar.gz
MDEV-5041 Inserting a TIME with hour>24 into a DATETIME column produces a wrong value
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 17398714d5b..78d39a79194 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5173,6 +5173,13 @@ int Field_temporal::store_time_dec(MYSQL_TIME *ltime, uint dec)
int error = 0, have_smth_to_conv= 1;
MYSQL_TIME l_time= *ltime;
Lazy_string_time str(ltime);
+
+ if (l_time.time_type == MYSQL_TIMESTAMP_TIME && time_to_datetime(&l_time))
+ {
+ have_smth_to_conv= 0;
+ error= 1;
+ goto store;
+ }
/*
We don't perform range checking here since values stored in TIME
structure always fit into DATETIME range.
@@ -5181,6 +5188,7 @@ int Field_temporal::store_time_dec(MYSQL_TIME *ltime, uint dec)
(current_thd->variables.sql_mode &
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
MODE_INVALID_DATES)), &error);
+store:
return store_TIME_with_warning(&l_time, &str, error, have_smth_to_conv);
}