diff options
-rw-r--r-- | mysql-test/r/type_time.result | 11 | ||||
-rw-r--r-- | mysql-test/t/type_time.test | 11 | ||||
-rw-r--r-- | sql/item.cc | 12 |
3 files changed, 25 insertions, 9 deletions
diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result index ad2e857a8d3..07e59099e4b 100644 --- a/mysql-test/r/type_time.result +++ b/mysql-test/r/type_time.result @@ -352,3 +352,14 @@ SELECT '-24:00:00' = (SELECT f1 FROM t1); '-24:00:00' = (SELECT f1 FROM t1) 1 DROP TABLE t1; +# +# MDEV-6592 Assertion `ltime->day == 0' failed with TIMESTAMP, MAKETIME +# +CREATE TABLE t1 (d DATE, c VARCHAR(10), KEY(d)) engine=myisam; +INSERT INTO t1 VALUES ('2008-10-02','2008-10-02'), ('2008-10-02','2008-10-02'); +SELECT * FROM t1 WHERE TIMESTAMP(c,'02:04:42') AND d <=> MAKETIME(97,0,7); +d c +DROP TABLE t1; +# +# End of 5.5 tests +# diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test index 88840e9b679..259b1819d21 100644 --- a/mysql-test/t/type_time.test +++ b/mysql-test/t/type_time.test @@ -239,3 +239,14 @@ SELECT CAST('-24:00:00' AS TIME) = (SELECT f1 FROM t1); SELECT '-24:00:00' = (SELECT f1 FROM t1); DROP TABLE t1; +--echo # +--echo # MDEV-6592 Assertion `ltime->day == 0' failed with TIMESTAMP, MAKETIME +--echo # +CREATE TABLE t1 (d DATE, c VARCHAR(10), KEY(d)) engine=myisam; +INSERT INTO t1 VALUES ('2008-10-02','2008-10-02'), ('2008-10-02','2008-10-02'); +SELECT * FROM t1 WHERE TIMESTAMP(c,'02:04:42') AND d <=> MAKETIME(97,0,7); +DROP TABLE t1; + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/sql/item.cc b/sql/item.cc index d58e4d285c5..b191e93808f 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -9015,17 +9015,11 @@ bool Item_cache_temporal::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) int Item_cache_temporal::save_in_field(Field *field, bool no_conversions) { - int error; - if (!has_value()) + MYSQL_TIME ltime; + if (get_date(<ime, 0)) return set_field_to_null_with_conversions(field, no_conversions); - field->set_notnull(); - - MYSQL_TIME ltime; - unpack_time(value, <ime); - ltime.time_type= mysql_type_to_time_type(field_type()); - error= field->store_time_dec(<ime, decimals); - + int error= field->store_time_dec(<ime, decimals); return error ? error : field->table->in_use->is_error() ? 1 : 0; } |