mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00'
This commit is contained in:
@ -5301,7 +5301,6 @@ f1
|
|||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: 'zz'
|
Warning 1292 Incorrect datetime value: 'zz'
|
||||||
Warning 1292 Incorrect datetime value: 'aa'
|
Warning 1292 Incorrect datetime value: 'aa'
|
||||||
Warning 1292 Incorrect datetime value: 'zz'
|
|
||||||
SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
|
SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
|
||||||
f1
|
f1
|
||||||
0000-00-00
|
0000-00-00
|
||||||
|
@ -5312,7 +5312,6 @@ f1
|
|||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: 'zz'
|
Warning 1292 Incorrect datetime value: 'zz'
|
||||||
Warning 1292 Incorrect datetime value: 'aa'
|
Warning 1292 Incorrect datetime value: 'aa'
|
||||||
Warning 1292 Incorrect datetime value: 'zz'
|
|
||||||
SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
|
SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
|
||||||
f1
|
f1
|
||||||
0000-00-00
|
0000-00-00
|
||||||
|
@ -5301,7 +5301,6 @@ f1
|
|||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: 'zz'
|
Warning 1292 Incorrect datetime value: 'zz'
|
||||||
Warning 1292 Incorrect datetime value: 'aa'
|
Warning 1292 Incorrect datetime value: 'aa'
|
||||||
Warning 1292 Incorrect datetime value: 'zz'
|
|
||||||
SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
|
SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
|
||||||
f1
|
f1
|
||||||
0000-00-00
|
0000-00-00
|
||||||
|
@ -402,13 +402,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')
|
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
|
||||||
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
|
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||||
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
||||||
date
|
date
|
||||||
2002-08-03
|
2002-08-03
|
||||||
|
@ -406,13 +406,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')
|
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
|
||||||
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
|
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||||
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
||||||
date
|
date
|
||||||
2002-08-03
|
2002-08-03
|
||||||
|
@ -409,13 +409,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')
|
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
|
||||||
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
|
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||||
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
||||||
date
|
date
|
||||||
2002-08-03
|
2002-08-03
|
||||||
|
@ -405,13 +405,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')
|
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
|
||||||
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
|
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||||
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
||||||
date
|
date
|
||||||
2002-08-03
|
2002-08-03
|
||||||
|
@ -408,13 +408,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')
|
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
|
||||||
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
|
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||||
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
||||||
date
|
date
|
||||||
2002-08-03
|
2002-08-03
|
||||||
|
@ -405,13 +405,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')
|
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
|
||||||
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
|
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
|
||||||
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
|
||||||
date
|
date
|
||||||
2002-08-03
|
2002-08-03
|
||||||
|
@ -503,12 +503,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a BETWEEN '2001-01-01
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '2001-01-01')
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2001-01-01')
|
||||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a IN ('2001-01-01','2001-01-02');
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a IN ('2001-01-01','2001-01-02');
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '2001-01-01')
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2001-01-01')
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# End of 10.1 tests
|
# End of 10.1 tests
|
||||||
@ -546,7 +546,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
|||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect date value: '2001-01-01x'
|
Warning 1292 Truncated incorrect date value: '2001-01-01x'
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '2001-01-01x') and (<cache>(hex(DATE'2001-01-01')) <> concat('xx',rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2001-01-01') and (<cache>(hex(DATE'2001-01-01')) <> concat('xx',rand())))
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (a DATE);
|
CREATE TABLE t1 (a DATE);
|
||||||
INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
|
INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
|
||||||
@ -565,14 +565,14 @@ SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' 2001-01-01';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' 2001-01-01') and (<cache>(length(DATE'2001-01-01')) = (11 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2001-01-01') and (<cache>(length(DATE'2001-01-01')) = (11 + rand())))
|
||||||
EXPLAIN EXTENDED
|
EXPLAIN EXTENDED
|
||||||
SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' garbage ';
|
SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' garbage ';
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: ' garbage '
|
Warning 1292 Incorrect datetime value: ' garbage '
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' garbage ') and (length(`test`.`t1`.`a`) = (11 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'0000-00-00') and (<cache>(length(DATE'0000-00-00')) = (11 + rand())))
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (a DATE);
|
CREATE TABLE t1 (a DATE);
|
||||||
INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01');
|
INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01');
|
||||||
@ -591,8 +591,162 @@ SELECT * FROM t1 WHERE LENGTH(a)=8+RAND() AND a='20010101';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '20010101') and (<cache>(length(DATE'2001-01-01')) = (8 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2001-01-01') and (<cache>(length(DATE'2001-01-01')) = (8 + rand())))
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
|
# MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00'
|
||||||
|
#
|
||||||
|
SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
|
||||||
|
CREATE TABLE t1 (a DATE);
|
||||||
|
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
|
||||||
|
SELECT * FROM t1 WHERE a=TIME'00:00:00';
|
||||||
|
a
|
||||||
|
2015-08-30
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10;
|
||||||
|
a
|
||||||
|
2015-08-30
|
||||||
|
2015-08-31
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00';
|
||||||
|
a
|
||||||
|
2015-08-30
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2015-08-30')
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2015-08-30') and (<cache>(length(DATE'2015-08-30')) = (30 + rand())))
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (a DATE);
|
||||||
|
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
|
||||||
|
SELECT * FROM t1 WHERE a=TIME'24:00:00';
|
||||||
|
a
|
||||||
|
2015-08-31
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10;
|
||||||
|
a
|
||||||
|
2015-08-30
|
||||||
|
2015-08-31
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00';
|
||||||
|
a
|
||||||
|
2015-08-31
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2015-08-31')
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'24:00:00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2015-08-31') and (<cache>(length(DATE'2015-08-31')) = (30 + rand())))
|
||||||
|
DROP TABLE t1;
|
||||||
|
# In this example '00:00:00' is not recognized as TIME'00:00:00'
|
||||||
|
# and is treated as DATE'0000-00-00'.
|
||||||
|
# This may change after MDEV-8322 Distinguish between time and date strings more carefully
|
||||||
|
CREATE TABLE t1 (a DATE);
|
||||||
|
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
|
||||||
|
SELECT * FROM t1 WHERE a='00:00:00';
|
||||||
|
a
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10;
|
||||||
|
a
|
||||||
|
2015-08-30
|
||||||
|
2015-08-31
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00';
|
||||||
|
a
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'0000-00-00')
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'0000-00-00') and (<cache>(length(DATE'0000-00-00')) = (30 + rand())))
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (a DATE);
|
||||||
|
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
|
||||||
|
SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00';
|
||||||
|
a
|
||||||
|
2015-08-30
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10;
|
||||||
|
a
|
||||||
|
2015-08-30
|
||||||
|
2015-08-31
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00';
|
||||||
|
a
|
||||||
|
2015-08-30
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00')
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00') and (<cache>(length(DATE'2015-08-30')) = (30 + rand())))
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (a DATE);
|
||||||
|
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
|
||||||
|
SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00.1';
|
||||||
|
a
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10;
|
||||||
|
a
|
||||||
|
2015-08-30
|
||||||
|
2015-08-31
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1';
|
||||||
|
a
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00.1')
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00.1';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00.1') and (<cache>(length(DATE'2015-08-30')) = (30 + rand())))
|
||||||
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (a DATE);
|
||||||
|
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
|
||||||
|
SELECT * FROM t1 WHERE a='2015-08-30 00:00:00';
|
||||||
|
a
|
||||||
|
2015-08-30
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10;
|
||||||
|
a
|
||||||
|
2015-08-30
|
||||||
|
2015-08-31
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00';
|
||||||
|
a
|
||||||
|
2015-08-30
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2015-08-30')
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='2015-08-30 00:00:00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = DATE'2015-08-30') and (<cache>(length(DATE'2015-08-30')) = (30 + rand())))
|
||||||
|
DROP TABLE t1;
|
||||||
|
SET timestamp=DEFAULT;
|
||||||
|
#
|
||||||
# End of 10.1 tests
|
# End of 10.1 tests
|
||||||
#
|
#
|
||||||
|
@ -411,21 +411,20 @@ a
|
|||||||
00:00:00
|
00:00:00
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect time value: '00:00:00x'
|
Warning 1292 Truncated incorrect time value: '00:00:00x'
|
||||||
Warning 1292 Truncated incorrect time value: '00:00:00x'
|
|
||||||
EXPLAIN EXTENDED
|
EXPLAIN EXTENDED
|
||||||
SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00x';
|
SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00x';
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect time value: '00:00:00x'
|
Warning 1292 Truncated incorrect time value: '00:00:00x'
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '00:00:00x')
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00')
|
||||||
EXPLAIN EXTENDED
|
EXPLAIN EXTENDED
|
||||||
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00x';
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00x';
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Truncated incorrect time value: '00:00:00x'
|
Warning 1292 Truncated incorrect time value: '00:00:00x'
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '00:00:00x') and (<cache>(length(TIME'00:00:00')) = (30 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (<cache>(length(TIME'00:00:00')) = (30 + rand())))
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
# Trailing fractional digits in string literals
|
# Trailing fractional digits in string literals
|
||||||
CREATE TABLE t1 (a TIME);
|
CREATE TABLE t1 (a TIME);
|
||||||
@ -442,13 +441,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00.000000';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '00:00:00.000000')
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00')
|
||||||
EXPLAIN EXTENDED
|
EXPLAIN EXTENDED
|
||||||
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00.000000';
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00.000000';
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '00:00:00.000000') and (<cache>(length(TIME'00:00:00')) = (30 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (<cache>(length(TIME'00:00:00')) = (30 + rand())))
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
# Trailing fractional digits in temporal literals
|
# Trailing fractional digits in temporal literals
|
||||||
CREATE TABLE t1 (a TIME);
|
CREATE TABLE t1 (a TIME);
|
||||||
@ -508,13 +507,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=' 00:00:00';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = ' 00:00:00')
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00')
|
||||||
EXPLAIN EXTENDED
|
EXPLAIN EXTENDED
|
||||||
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' 00:00:00';
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' 00:00:00';
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' 00:00:00') and (<cache>(length(TIME'00:00:00')) = (30 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (<cache>(length(TIME'00:00:00')) = (30 + rand())))
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
# Numeric format in string literals
|
# Numeric format in string literals
|
||||||
CREATE TABLE t1 (a TIME);
|
CREATE TABLE t1 (a TIME);
|
||||||
@ -531,13 +530,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='000000';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '000000')
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00')
|
||||||
EXPLAIN EXTENDED
|
EXPLAIN EXTENDED
|
||||||
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='000000';
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='000000';
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '000000') and (<cache>(length(TIME'00:00:00')) = (30 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (<cache>(length(TIME'00:00:00')) = (30 + rand())))
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# MDEV-8766 Wrong result for SELECT..WHERE LENGTH(time_column)=8 AND time_column=TIMESTAMP'2001-01-01 10:20:31'
|
# MDEV-8766 Wrong result for SELECT..WHERE LENGTH(time_column)=8 AND time_column=TIMESTAMP'2001-01-01 10:20:31'
|
||||||
@ -560,13 +559,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 10:20:31')
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31')
|
||||||
EXPLAIN EXTENDED
|
EXPLAIN EXTENDED
|
||||||
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31';
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31';
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 10:20:31') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
# TIMESTAMP literal with a bigger scale and fractional second truncation
|
# TIMESTAMP literal with a bigger scale and fractional second truncation
|
||||||
# Ok to propagate with precision truncation
|
# Ok to propagate with precision truncation
|
||||||
@ -584,13 +583,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 10:20:31.123')
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31.123000')
|
||||||
EXPLAIN EXTENDED
|
EXPLAIN EXTENDED
|
||||||
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.123';
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.123';
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 10:20:31.123') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
# TIMESTAMP literal with a bigger scale and no fractional second truncation
|
# TIMESTAMP literal with a bigger scale and no fractional second truncation
|
||||||
# Ok to propagate
|
# Ok to propagate
|
||||||
@ -610,13 +609,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.000';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 10:20:31.000')
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31')
|
||||||
EXPLAIN EXTENDED
|
EXPLAIN EXTENDED
|
||||||
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.000';
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.000';
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 10:20:31.000') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
# TIMESTAMP literal with a smaller scale
|
# TIMESTAMP literal with a smaller scale
|
||||||
# Ok to propagate
|
# Ok to propagate
|
||||||
@ -639,7 +638,7 @@ SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.1
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 10:20:31.123') and (<cache>(length(TIME'10:20:31.123000')) = (30 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and (<cache>(length(TIME'10:20:31.123000')) = (30 + rand())))
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
# TIME literal with a bigger scale and fractional second truncation
|
# TIME literal with a bigger scale and fractional second truncation
|
||||||
# Ok to propagate with precision truncation
|
# Ok to propagate with precision truncation
|
||||||
@ -730,13 +729,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '10:20:31.123')
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31.123000')
|
||||||
EXPLAIN EXTENDED
|
EXPLAIN EXTENDED
|
||||||
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.123';
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.123';
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '10:20:31.123') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
# TIME-alike string literal with a bigger scale and no fractional second truncation
|
# TIME-alike string literal with a bigger scale and no fractional second truncation
|
||||||
# Ok to propagate
|
# Ok to propagate
|
||||||
@ -756,13 +755,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.000';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '10:20:31.000')
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:31')
|
||||||
EXPLAIN EXTENDED
|
EXPLAIN EXTENDED
|
||||||
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.000';
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.000';
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '10:20:31.000') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31') and (<cache>(length(TIME'10:20:31')) = (30 + rand())))
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
# TIME-alike string literal with a smaller scale
|
# TIME-alike string literal with a smaller scale
|
||||||
# Ok to propagate
|
# Ok to propagate
|
||||||
@ -785,7 +784,7 @@ SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.123';
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '10:20:31.123') and (<cache>(length(TIME'10:20:31.123000')) = (30 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:31.123000') and (<cache>(length(TIME'10:20:31.123000')) = (30 + rand())))
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
SET timestamp=DEFAULT;
|
SET timestamp=DEFAULT;
|
||||||
SET @@old_mode=zero_date_time_cast;
|
SET @@old_mode=zero_date_time_cast;
|
||||||
@ -816,13 +815,13 @@ SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=8;
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'0000-00-00 10:20:30')
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:30')
|
||||||
EXPLAIN EXTENDED
|
EXPLAIN EXTENDED
|
||||||
SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=30+RAND();
|
SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=30+RAND();
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'0000-00-00 10:20:30') and (<cache>(length(TIME'10:20:30')) = (30 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:30') and (<cache>(length(TIME'10:20:30')) = (30 + rand())))
|
||||||
# Old mode, TIMESTAMP literal, zon-zero YYYYMMDD, no propagation
|
# Old mode, TIMESTAMP literal, zon-zero YYYYMMDD, no propagation
|
||||||
SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30';
|
SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30';
|
||||||
a
|
a
|
||||||
@ -854,13 +853,13 @@ SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=8;
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '0000-00-00 10:20:30')
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'10:20:30')
|
||||||
EXPLAIN EXTENDED
|
EXPLAIN EXTENDED
|
||||||
SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=30+RAND();
|
SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=30+RAND();
|
||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '0000-00-00 10:20:30') and (<cache>(length(TIME'10:20:30')) = (30 + rand())))
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'10:20:30') and (<cache>(length(TIME'10:20:30')) = (30 + rand())))
|
||||||
# Old mode, TIMESTAMP-alike literal, zon-zero YYYYMMDD, no propagation
|
# Old mode, TIMESTAMP-alike literal, zon-zero YYYYMMDD, no propagation
|
||||||
SELECT * FROM t1 WHERE a='0000-00-01 10:20:30';
|
SELECT * FROM t1 WHERE a='0000-00-01 10:20:30';
|
||||||
a
|
a
|
||||||
@ -883,5 +882,81 @@ Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a`
|
|||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
SET @@old_mode=DEFAULT;
|
SET @@old_mode=DEFAULT;
|
||||||
#
|
#
|
||||||
|
# MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00'
|
||||||
|
#
|
||||||
|
SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
|
||||||
|
CREATE TABLE t1 (a TIME);
|
||||||
|
INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
|
||||||
|
SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00';
|
||||||
|
a
|
||||||
|
00:00:00
|
||||||
|
SELECT * FROM t1 WHERE a='00:00:00';
|
||||||
|
a
|
||||||
|
00:00:00
|
||||||
|
SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00';
|
||||||
|
a
|
||||||
|
00:00:00
|
||||||
|
SELECT * FROM t1 WHERE a>=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00';
|
||||||
|
a
|
||||||
|
00:00:00
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE a>=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00')
|
||||||
|
DROP TABLE t1;
|
||||||
|
SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
|
||||||
|
CREATE TABLE t1 (a TIME);
|
||||||
|
INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
|
||||||
|
SELECT * FROM t1 WHERE DATE(a)<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00';
|
||||||
|
a
|
||||||
|
00:00:00
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE DATE(a)<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00')
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= TIMESTAMP'2015-08-30 00:00:00.1'))
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00.1';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00.100000') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= TIMESTAMP'2015-08-30 00:00:00.1'))
|
||||||
|
DROP TABLE t1;
|
||||||
|
SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
|
||||||
|
CREATE TABLE t1 (a TIME);
|
||||||
|
INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
|
||||||
|
SELECT * FROM t1 WHERE DATE(a)<=DATE'2015-08-30' AND a='00:00:00';
|
||||||
|
a
|
||||||
|
00:00:00
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE DATE(a)<=DATE'2015-08-30' AND a='00:00:00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00')
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= DATE'2015-08-30'))
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00.1';
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00.100000') and (timestamp('2015-08-08',(TIME'00:00:00' + rand())) <= DATE'2015-08-30'))
|
||||||
|
DROP TABLE t1;
|
||||||
|
SET timestamp=DEFAULT;
|
||||||
|
#
|
||||||
# End of 10.1 tests
|
# End of 10.1 tests
|
||||||
#
|
#
|
||||||
|
@ -451,6 +451,85 @@ EXPLAIN EXTENDED
|
|||||||
SELECT * FROM t1 WHERE LENGTH(a)=8+RAND() AND a='20010101';
|
SELECT * FROM t1 WHERE LENGTH(a)=8+RAND() AND a='20010101';
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00'
|
||||||
|
--echo #
|
||||||
|
SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a DATE);
|
||||||
|
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
|
||||||
|
SELECT * FROM t1 WHERE a=TIME'00:00:00';
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10;
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00';
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
# Special case: zero TIME part after conversion to DATETIME
|
||||||
|
CREATE TABLE t1 (a DATE);
|
||||||
|
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
|
||||||
|
SELECT * FROM t1 WHERE a=TIME'24:00:00';
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10;
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'24:00:00';
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo # In this example '00:00:00' is not recognized as TIME'00:00:00'
|
||||||
|
--echo # and is treated as DATE'0000-00-00'.
|
||||||
|
--echo # This may change after MDEV-8322 Distinguish between time and date strings more carefully
|
||||||
|
CREATE TABLE t1 (a DATE);
|
||||||
|
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
|
||||||
|
SELECT * FROM t1 WHERE a='00:00:00';
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10;
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00';
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
# DATETIME native literal
|
||||||
|
CREATE TABLE t1 (a DATE);
|
||||||
|
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
|
||||||
|
SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00';
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10;
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00';
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
# DATETIME native literal with non-zero time
|
||||||
|
CREATE TABLE t1 (a DATE);
|
||||||
|
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
|
||||||
|
SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00.1';
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10;
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00.1';
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
# DATETIME-alike string literal
|
||||||
|
CREATE TABLE t1 (a DATE);
|
||||||
|
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
|
||||||
|
SELECT * FROM t1 WHERE a='2015-08-30 00:00:00';
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10;
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='2015-08-30 00:00:00';
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
SET timestamp=DEFAULT;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.1 tests
|
--echo # End of 10.1 tests
|
||||||
|
@ -534,6 +534,48 @@ DROP TABLE t1;
|
|||||||
|
|
||||||
SET @@old_mode=DEFAULT;
|
SET @@old_mode=DEFAULT;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00'
|
||||||
|
--echo #
|
||||||
|
SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
|
||||||
|
CREATE TABLE t1 (a TIME);
|
||||||
|
INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
|
||||||
|
SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00';
|
||||||
|
SELECT * FROM t1 WHERE a='00:00:00';
|
||||||
|
SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00';
|
||||||
|
SELECT * FROM t1 WHERE a>=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE a>=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00';
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
# TIMESTAMP literal with fractional seconds
|
||||||
|
SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
|
||||||
|
CREATE TABLE t1 (a TIME);
|
||||||
|
INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
|
||||||
|
SELECT * FROM t1 WHERE DATE(a)<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE DATE(a)<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00.1';
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
# DATE literal
|
||||||
|
SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
|
||||||
|
CREATE TABLE t1 (a TIME);
|
||||||
|
INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
|
||||||
|
SELECT * FROM t1 WHERE DATE(a)<=DATE'2015-08-30' AND a='00:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE DATE(a)<=DATE'2015-08-30' AND a='00:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00';
|
||||||
|
EXPLAIN EXTENDED
|
||||||
|
SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00.1';
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
SET timestamp=DEFAULT;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.1 tests
|
--echo # End of 10.1 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
59
sql/field.cc
59
sql/field.cc
@ -5841,7 +5841,30 @@ Item *Field_time::get_equal_const_item(THD *thd, const Context &ctx,
|
|||||||
Item *const_item)
|
Item *const_item)
|
||||||
{
|
{
|
||||||
switch (ctx.subst_constraint()) {
|
switch (ctx.subst_constraint()) {
|
||||||
case IDENTITY_SUBST:
|
case ANY_SUBST:
|
||||||
|
if (const_item->field_type() != MYSQL_TYPE_TIME)
|
||||||
|
{
|
||||||
|
MYSQL_TIME ltime;
|
||||||
|
// Get the value of const_item with conversion from DATETIME to TIME
|
||||||
|
if (const_item->get_time_with_conversion(thd, <ime, TIME_TIME_ONLY))
|
||||||
|
return NULL;
|
||||||
|
/*
|
||||||
|
Replace a DATE/DATETIME constant to a TIME constant:
|
||||||
|
WHERE LENGTH(time_column)=8
|
||||||
|
AND time_column=TIMESTAMP'2015-08-30 10:20:30';
|
||||||
|
to:
|
||||||
|
WHERE LENGTH(time_column)=10
|
||||||
|
AND time_column=TIME'10:20:30'
|
||||||
|
|
||||||
|
(assuming CURRENT_DATE is '2015-08-30'
|
||||||
|
*/
|
||||||
|
return new (thd->mem_root) Item_time_literal(thd, <ime,
|
||||||
|
ltime.second_part ?
|
||||||
|
TIME_SECOND_PART_DIGITS :
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IDENTITY_SUBST:
|
||||||
if (const_item->field_type() != MYSQL_TYPE_TIME ||
|
if (const_item->field_type() != MYSQL_TYPE_TIME ||
|
||||||
const_item->decimals != decimals())
|
const_item->decimals != decimals())
|
||||||
{
|
{
|
||||||
@ -5865,8 +5888,6 @@ Item *Field_time::get_equal_const_item(THD *thd, const Context &ctx,
|
|||||||
return new (thd->mem_root) Item_time_literal(thd, <ime, decimals());
|
return new (thd->mem_root) Item_time_literal(thd, <ime, decimals());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ANY_SUBST:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return const_item;
|
return const_item;
|
||||||
}
|
}
|
||||||
@ -6308,6 +6329,35 @@ Item *Field_newdate::get_equal_const_item(THD *thd, const Context &ctx,
|
|||||||
Item *const_item)
|
Item *const_item)
|
||||||
{
|
{
|
||||||
switch (ctx.subst_constraint()) {
|
switch (ctx.subst_constraint()) {
|
||||||
|
case ANY_SUBST:
|
||||||
|
if (!is_temporal_type_with_date(const_item->field_type()))
|
||||||
|
{
|
||||||
|
MYSQL_TIME ltime;
|
||||||
|
// Get the value of const_item with conversion from TIME to DATETIME
|
||||||
|
if (const_item->get_date_with_conversion(<ime,
|
||||||
|
TIME_FUZZY_DATES | TIME_INVALID_DATES))
|
||||||
|
return NULL;
|
||||||
|
/*
|
||||||
|
Replace the constant to a DATE or DATETIME constant.
|
||||||
|
Example:
|
||||||
|
WHERE LENGTH(date_column)=10
|
||||||
|
AND date_column=TIME'10:20:30';
|
||||||
|
to:
|
||||||
|
WHERE LENGTH(date_column)=10
|
||||||
|
AND date_column=TIMESTAMP'2015-08-30 10:20:30'
|
||||||
|
|
||||||
|
(assuming CURRENT_DATE is '2015-08-30'
|
||||||
|
*/
|
||||||
|
if (non_zero_hhmmssuu(<ime))
|
||||||
|
return new (thd->mem_root)
|
||||||
|
Item_datetime_literal_for_invalid_dates(thd, <ime,
|
||||||
|
ltime.second_part ?
|
||||||
|
TIME_SECOND_PART_DIGITS : 0);
|
||||||
|
datetime_to_date(<ime);
|
||||||
|
return new (thd->mem_root)
|
||||||
|
Item_date_literal_for_invalid_dates(thd, <ime);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case IDENTITY_SUBST:
|
case IDENTITY_SUBST:
|
||||||
if (const_item->field_type() != MYSQL_TYPE_DATE)
|
if (const_item->field_type() != MYSQL_TYPE_DATE)
|
||||||
{
|
{
|
||||||
@ -6316,11 +6366,10 @@ Item *Field_newdate::get_equal_const_item(THD *thd, const Context &ctx,
|
|||||||
const_item->get_date_with_conversion(<ime, 0) :
|
const_item->get_date_with_conversion(<ime, 0) :
|
||||||
const_item->get_date(<ime, 0))
|
const_item->get_date(<ime, 0))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
datetime_to_date(<ime);
|
||||||
return new (thd->mem_root) Item_date_literal(thd, <ime);
|
return new (thd->mem_root) Item_date_literal(thd, <ime);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ANY_SUBST:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return const_item;
|
return const_item;
|
||||||
}
|
}
|
||||||
|
56
sql/item.h
56
sql/item.h
@ -3385,6 +3385,62 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
An error-safe counterpart for Item_date_literal
|
||||||
|
*/
|
||||||
|
class Item_date_literal_for_invalid_dates: public Item_date_literal
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
During equal field propagation we can replace non-temporal constants
|
||||||
|
found in equalities to their native temporal equivalents:
|
||||||
|
WHERE date_column='2001-01-01' ... ->
|
||||||
|
WHERE date_column=DATE'2001-01-01' ...
|
||||||
|
|
||||||
|
This is done to make the eqial field propagation code handle mixtures of
|
||||||
|
different temporal types in the same expressions easier (MDEV-8706), e.g.
|
||||||
|
WHERE LENGTH(date_column)=10 AND date_column=TIME'00:00:00'
|
||||||
|
|
||||||
|
Item_date_literal_for_invalid_dates::get_date()
|
||||||
|
(unlike the regular Item_date_literal::get_date())
|
||||||
|
does not check the result for NO_ZERO_IN_DATE and NO_ZER_DATE,
|
||||||
|
always returns success (false), and does not produce error/warning messages.
|
||||||
|
|
||||||
|
We need these _for_invalid_dates classes to be able to rewrite:
|
||||||
|
SELECT * FROM t1 WHERE date_column='0000-00-00' ...
|
||||||
|
to:
|
||||||
|
SELECT * FROM t1 WHERE date_column=DATE'0000-00-00' ...
|
||||||
|
|
||||||
|
to avoid returning NULL value instead of '0000-00-00' even
|
||||||
|
in sql_mode=TRADITIONAL.
|
||||||
|
*/
|
||||||
|
public:
|
||||||
|
Item_date_literal_for_invalid_dates(THD *thd, MYSQL_TIME *ltime)
|
||||||
|
:Item_date_literal(thd, ltime) { }
|
||||||
|
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
|
||||||
|
{
|
||||||
|
*ltime= cached_time;
|
||||||
|
return (null_value= false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
An error-safe counterpart for Item_datetime_literal
|
||||||
|
(see Item_date_literal_for_invalid_dates for comments)
|
||||||
|
*/
|
||||||
|
class Item_datetime_literal_for_invalid_dates: public Item_datetime_literal
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Item_datetime_literal_for_invalid_dates(THD *thd,
|
||||||
|
MYSQL_TIME *ltime, uint dec_arg)
|
||||||
|
:Item_datetime_literal(thd, ltime, dec_arg) { }
|
||||||
|
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
|
||||||
|
{
|
||||||
|
*ltime= cached_time;
|
||||||
|
return (null_value= false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Array of items, e.g. function or aggerate function arguments.
|
Array of items, e.g. function or aggerate function arguments.
|
||||||
|
@ -125,6 +125,7 @@ public:
|
|||||||
((Item_func*)owner)->functype() == Item_func::EQUAL_FUNC);
|
((Item_func*)owner)->functype() == Item_func::EQUAL_FUNC);
|
||||||
}
|
}
|
||||||
Item_result compare_type() const { return m_compare_type; }
|
Item_result compare_type() const { return m_compare_type; }
|
||||||
|
Arg_comparator *subcomparators() const { return comparators; }
|
||||||
void cleanup()
|
void cleanup()
|
||||||
{
|
{
|
||||||
delete [] comparators;
|
delete [] comparators;
|
||||||
|
@ -12522,7 +12522,8 @@ finish:
|
|||||||
FALSE otherwise
|
FALSE otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool check_simple_equality(THD *thd, Item *left_item, Item *right_item,
|
static bool check_simple_equality(THD *thd, const Item::Context &ctx,
|
||||||
|
Item *left_item, Item *right_item,
|
||||||
COND_EQUAL *cond_equal)
|
COND_EQUAL *cond_equal)
|
||||||
{
|
{
|
||||||
Item *orig_left_item= left_item;
|
Item *orig_left_item= left_item;
|
||||||
@ -12686,6 +12687,11 @@ static bool check_simple_equality(THD *thd, Item *left_item, Item *right_item,
|
|||||||
cond_equal->current_level.push_back(item_equal, thd->mem_root);
|
cond_equal->current_level.push_back(item_equal, thd->mem_root);
|
||||||
item_equal->set_context_field(field_item);
|
item_equal->set_context_field(field_item);
|
||||||
}
|
}
|
||||||
|
Item *const_item2= field_item->field->get_equal_const_item(thd, ctx,
|
||||||
|
const_item);
|
||||||
|
if (!const_item2)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (item_equal)
|
if (item_equal)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -12693,11 +12699,11 @@ static bool check_simple_equality(THD *thd, Item *left_item, Item *right_item,
|
|||||||
already contains a constant and its value is not equal to
|
already contains a constant and its value is not equal to
|
||||||
the value of const_item.
|
the value of const_item.
|
||||||
*/
|
*/
|
||||||
item_equal->add_const(thd, const_item, orig_field_item);
|
item_equal->add_const(thd, const_item2, orig_field_item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item_equal= new (thd->mem_root) Item_equal(thd, const_item,
|
item_equal= new (thd->mem_root) Item_equal(thd, const_item2,
|
||||||
orig_field_item, TRUE);
|
orig_field_item, TRUE);
|
||||||
item_equal->set_context_field(field_item);
|
item_equal->set_context_field(field_item);
|
||||||
cond_equal->current_level.push_back(item_equal, thd->mem_root);
|
cond_equal->current_level.push_back(item_equal, thd->mem_root);
|
||||||
@ -12735,7 +12741,8 @@ static bool check_simple_equality(THD *thd, Item *left_item, Item *right_item,
|
|||||||
FALSE otherwise
|
FALSE otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool check_row_equality(THD *thd, Item *left_row, Item_row *right_row,
|
static bool check_row_equality(THD *thd, const Arg_comparator *comparators,
|
||||||
|
Item *left_row, Item_row *right_row,
|
||||||
COND_EQUAL *cond_equal, List<Item>* eq_list)
|
COND_EQUAL *cond_equal, List<Item>* eq_list)
|
||||||
{
|
{
|
||||||
uint n= left_row->cols();
|
uint n= left_row->cols();
|
||||||
@ -12747,14 +12754,20 @@ static bool check_row_equality(THD *thd, Item *left_row, Item_row *right_row,
|
|||||||
if (left_item->type() == Item::ROW_ITEM &&
|
if (left_item->type() == Item::ROW_ITEM &&
|
||||||
right_item->type() == Item::ROW_ITEM)
|
right_item->type() == Item::ROW_ITEM)
|
||||||
{
|
{
|
||||||
is_converted= check_row_equality(thd,
|
is_converted= check_row_equality(thd,
|
||||||
|
comparators[i].subcomparators(),
|
||||||
(Item_row *) left_item,
|
(Item_row *) left_item,
|
||||||
(Item_row *) right_item,
|
(Item_row *) right_item,
|
||||||
cond_equal, eq_list);
|
cond_equal, eq_list);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
is_converted= check_simple_equality(thd, left_item, right_item,
|
const Arg_comparator *tmp= &comparators[i];
|
||||||
|
is_converted= check_simple_equality(thd,
|
||||||
|
Item::Context(Item::ANY_SUBST,
|
||||||
|
tmp->compare_type(),
|
||||||
|
tmp->cmp_collation.collation),
|
||||||
|
left_item, right_item,
|
||||||
cond_equal);
|
cond_equal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12812,11 +12825,16 @@ bool Item_func_eq::check_equality(THD *thd, COND_EQUAL *cond_equal,
|
|||||||
right_item->type() == Item::ROW_ITEM)
|
right_item->type() == Item::ROW_ITEM)
|
||||||
{
|
{
|
||||||
return check_row_equality(thd,
|
return check_row_equality(thd,
|
||||||
|
cmp.subcomparators(),
|
||||||
(Item_row *) left_item,
|
(Item_row *) left_item,
|
||||||
(Item_row *) right_item,
|
(Item_row *) right_item,
|
||||||
cond_equal, eq_list);
|
cond_equal, eq_list);
|
||||||
}
|
}
|
||||||
return check_simple_equality(thd, left_item, right_item, cond_equal);
|
return check_simple_equality(thd,
|
||||||
|
Context(ANY_SUBST,
|
||||||
|
compare_type(),
|
||||||
|
compare_collation()),
|
||||||
|
left_item, right_item, cond_equal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user