MDEV-15570 Assertion `Item_cache_temporal::field_type() != MYSQL_TYPE_TIME' failed in Item_cache_temporal::val_datetime_packed

remove an assert. TIME value can be used (and cached) in a datetime context
This commit is contained in:
Sergei Golubchik 2018-03-22 15:07:33 +01:00
parent e147a4a067
commit f249d8467a
3 changed files with 14 additions and 1 deletions

View file

@ -154,3 +154,9 @@ SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b;
Warnings:
Warning 1292 Incorrect datetime value: ''
DROP TABLE t1;
CREATE TABLE t1 (d DATE) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('2012-12-21');
SELECT * FROM t1 WHERE LEAST( UTC_TIME(), d );
d
2012-12-21
DROP TABLE t1;

View file

@ -58,3 +58,11 @@ SELECT * FROM t1 IGNORE KEY (b) WHERE b='';
SELECT * FROM t1 WHERE a=b;
SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b;
DROP TABLE t1;
#
# MDEV-15570 Assertion `Item_cache_temporal::field_type() != MYSQL_TYPE_TIME' failed in Item_cache_temporal::val_datetime_packed
#
CREATE TABLE t1 (d DATE) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('2012-12-21');
SELECT * FROM t1 WHERE LEAST( UTC_TIME(), d );
DROP TABLE t1;

View file

@ -9707,7 +9707,6 @@ Item_cache_temporal::Item_cache_temporal(THD *thd,
longlong Item_cache_temporal::val_datetime_packed()
{
DBUG_ASSERT(fixed == 1);
DBUG_ASSERT(Item_cache_temporal::field_type() != MYSQL_TYPE_TIME);
if ((!value_cached && !cache_value()) || null_value)
{
null_value= TRUE;