Commit 68354ef2 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-6592 Assertion `ltime->day == 0' failed with TIMESTAMP, MAKETIME

parent b737d902
...@@ -352,3 +352,14 @@ SELECT '-24:00:00' = (SELECT f1 FROM t1); ...@@ -352,3 +352,14 @@ SELECT '-24:00:00' = (SELECT f1 FROM t1);
'-24:00:00' = (SELECT f1 FROM t1) '-24:00:00' = (SELECT f1 FROM t1)
1 1
DROP TABLE t1; 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
#
...@@ -239,3 +239,14 @@ SELECT CAST('-24:00:00' AS TIME) = (SELECT f1 FROM t1); ...@@ -239,3 +239,14 @@ SELECT CAST('-24:00:00' AS TIME) = (SELECT f1 FROM t1);
SELECT '-24:00:00' = (SELECT f1 FROM t1); SELECT '-24:00:00' = (SELECT f1 FROM t1);
DROP TABLE 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 #
...@@ -9015,17 +9015,11 @@ bool Item_cache_temporal::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) ...@@ -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 Item_cache_temporal::save_in_field(Field *field, bool no_conversions)
{ {
int error; MYSQL_TIME ltime;
if (!has_value()) if (get_date(&ltime, 0))
return set_field_to_null_with_conversions(field, no_conversions); return set_field_to_null_with_conversions(field, no_conversions);
field->set_notnull(); field->set_notnull();
int error= field->store_time_dec(&ltime, decimals);
MYSQL_TIME ltime;
unpack_time(value, &ltime);
ltime.time_type= mysql_type_to_time_type(field_type());
error= field->store_time_dec(&ltime, decimals);
return error ? error : field->table->in_use->is_error() ? 1 : 0; return error ? error : field->table->in_use->is_error() ? 1 : 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment