Skip to content

Commit 39b46ae

Browse files
author
Alexander Barkov
committed
MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00'
1 parent 3fcd84c commit 39b46ae

17 files changed

+529
-58
lines changed

mysql-test/r/select.result

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5301,7 +5301,6 @@ f1
53015301
Warnings:
53025302
Warning 1292 Incorrect datetime value: 'zz'
53035303
Warning 1292 Incorrect datetime value: 'aa'
5304-
Warning 1292 Incorrect datetime value: 'zz'
53055304
SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
53065305
f1
53075306
0000-00-00

mysql-test/r/select_jcl6.result

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5312,7 +5312,6 @@ f1
53125312
Warnings:
53135313
Warning 1292 Incorrect datetime value: 'zz'
53145314
Warning 1292 Incorrect datetime value: 'aa'
5315-
Warning 1292 Incorrect datetime value: 'zz'
53165315
SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
53175316
f1
53185317
0000-00-00

mysql-test/r/select_pkeycache.result

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5301,7 +5301,6 @@ f1
53015301
Warnings:
53025302
Warning 1292 Incorrect datetime value: 'zz'
53035303
Warning 1292 Incorrect datetime value: 'aa'
5304-
Warning 1292 Incorrect datetime value: 'zz'
53055304
SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
53065305
f1
53075306
0000-00-00

mysql-test/r/subselect.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,13 +402,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
402402
id select_type table type possible_keys key key_len ref rows filtered Extra
403403
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
404404
Warnings:
405-
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')
405+
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
406406
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
407407
id select_type table type possible_keys key key_len ref rows filtered Extra
408408
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
409409
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
410410
Warnings:
411-
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')`
411+
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')`
412412
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
413413
date
414414
2002-08-03

mysql-test/r/subselect_no_exists_to_in.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,13 +406,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
406406
id select_type table type possible_keys key key_len ref rows filtered Extra
407407
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
408408
Warnings:
409-
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')
409+
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
410410
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
411411
id select_type table type possible_keys key key_len ref rows filtered Extra
412412
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
413413
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
414414
Warnings:
415-
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')`
415+
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')`
416416
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
417417
date
418418
2002-08-03

mysql-test/r/subselect_no_mat.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,13 +409,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
409409
id select_type table type possible_keys key key_len ref rows filtered Extra
410410
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
411411
Warnings:
412-
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')
412+
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
413413
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
414414
id select_type table type possible_keys key key_len ref rows filtered Extra
415415
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
416416
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
417417
Warnings:
418-
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')`
418+
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')`
419419
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
420420
date
421421
2002-08-03

mysql-test/r/subselect_no_opts.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
405405
id select_type table type possible_keys key key_len ref rows filtered Extra
406406
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
407407
Warnings:
408-
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')
408+
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
409409
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
410410
id select_type table type possible_keys key key_len ref rows filtered Extra
411411
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
412412
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
413413
Warnings:
414-
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')`
414+
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')`
415415
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
416416
date
417417
2002-08-03

mysql-test/r/subselect_no_scache.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
408408
id select_type table type possible_keys key key_len ref rows filtered Extra
409409
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
410410
Warnings:
411-
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')
411+
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
412412
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
413413
id select_type table type possible_keys key key_len ref rows filtered Extra
414414
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
415415
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
416416
Warnings:
417-
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')`
417+
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')`
418418
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
419419
date
420420
2002-08-03

mysql-test/r/subselect_no_semijoin.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
405405
id select_type table type possible_keys key key_len ref rows filtered Extra
406406
1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
407407
Warnings:
408-
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')
408+
Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = DATE'2002-08-03')
409409
EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
410410
id select_type table type possible_keys key key_len ref rows filtered Extra
411411
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
412412
2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
413413
Warnings:
414-
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')`
414+
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')`
415415
SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
416416
date
417417
2002-08-03

mysql-test/r/type_date.result

Lines changed: 160 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -503,12 +503,12 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a BETWEEN '2001-01-01
503503
id select_type table type possible_keys key key_len ref rows filtered Extra
504504
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
505505
Warnings:
506-
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '2001-01-01')
506+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2001-01-01')
507507
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a IN ('2001-01-01','2001-01-02');
508508
id select_type table type possible_keys key key_len ref rows filtered Extra
509509
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
510510
Warnings:
511-
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '2001-01-01')
511+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2001-01-01')
512512
DROP TABLE t1;
513513
#
514514
# End of 10.1 tests
@@ -546,7 +546,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
546546
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
547547
Warnings:
548548
Warning 1292 Truncated incorrect date value: '2001-01-01x'
549-
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())))
549+
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())))
550550
DROP TABLE t1;
551551
CREATE TABLE t1 (a DATE);
552552
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';
565565
id select_type table type possible_keys key key_len ref rows filtered Extra
566566
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
567567
Warnings:
568-
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())))
568+
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())))
569569
EXPLAIN EXTENDED
570570
SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' garbage ';
571571
id select_type table type possible_keys key key_len ref rows filtered Extra
572572
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
573573
Warnings:
574574
Warning 1292 Incorrect datetime value: ' garbage '
575-
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' garbage ') and (length(`test`.`t1`.`a`) = (11 + rand())))
575+
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())))
576576
DROP TABLE t1;
577577
CREATE TABLE t1 (a DATE);
578578
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';
591591
id select_type table type possible_keys key key_len ref rows filtered Extra
592592
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
593593
Warnings:
594-
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())))
594+
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())))
595595
DROP TABLE t1;
596596
#
597+
# MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00'
598+
#
599+
SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
600+
CREATE TABLE t1 (a DATE);
601+
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
602+
SELECT * FROM t1 WHERE a=TIME'00:00:00';
603+
a
604+
2015-08-30
605+
SELECT * FROM t1 WHERE LENGTH(a)=10;
606+
a
607+
2015-08-30
608+
2015-08-31
609+
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00';
610+
a
611+
2015-08-30
612+
EXPLAIN EXTENDED
613+
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00';
614+
id select_type table type possible_keys key key_len ref rows filtered Extra
615+
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
616+
Warnings:
617+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2015-08-30')
618+
EXPLAIN EXTENDED
619+
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00';
620+
id select_type table type possible_keys key key_len ref rows filtered Extra
621+
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
622+
Warnings:
623+
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())))
624+
DROP TABLE t1;
625+
CREATE TABLE t1 (a DATE);
626+
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
627+
SELECT * FROM t1 WHERE a=TIME'24:00:00';
628+
a
629+
2015-08-31
630+
SELECT * FROM t1 WHERE LENGTH(a)=10;
631+
a
632+
2015-08-30
633+
2015-08-31
634+
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00';
635+
a
636+
2015-08-31
637+
EXPLAIN EXTENDED
638+
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00';
639+
id select_type table type possible_keys key key_len ref rows filtered Extra
640+
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
641+
Warnings:
642+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2015-08-31')
643+
EXPLAIN EXTENDED
644+
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'24:00:00';
645+
id select_type table type possible_keys key key_len ref rows filtered Extra
646+
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
647+
Warnings:
648+
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())))
649+
DROP TABLE t1;
650+
# In this example '00:00:00' is not recognized as TIME'00:00:00'
651+
# and is treated as DATE'0000-00-00'.
652+
# This may change after MDEV-8322 Distinguish between time and date strings more carefully
653+
CREATE TABLE t1 (a DATE);
654+
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
655+
SELECT * FROM t1 WHERE a='00:00:00';
656+
a
657+
SELECT * FROM t1 WHERE LENGTH(a)=10;
658+
a
659+
2015-08-30
660+
2015-08-31
661+
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00';
662+
a
663+
EXPLAIN EXTENDED
664+
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00';
665+
id select_type table type possible_keys key key_len ref rows filtered Extra
666+
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
667+
Warnings:
668+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'0000-00-00')
669+
EXPLAIN EXTENDED
670+
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00';
671+
id select_type table type possible_keys key key_len ref rows filtered Extra
672+
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
673+
Warnings:
674+
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())))
675+
DROP TABLE t1;
676+
CREATE TABLE t1 (a DATE);
677+
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
678+
SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00';
679+
a
680+
2015-08-30
681+
SELECT * FROM t1 WHERE LENGTH(a)=10;
682+
a
683+
2015-08-30
684+
2015-08-31
685+
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00';
686+
a
687+
2015-08-30
688+
EXPLAIN EXTENDED
689+
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00';
690+
id select_type table type possible_keys key key_len ref rows filtered Extra
691+
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
692+
Warnings:
693+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00')
694+
EXPLAIN EXTENDED
695+
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00';
696+
id select_type table type possible_keys key key_len ref rows filtered Extra
697+
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
698+
Warnings:
699+
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())))
700+
DROP TABLE t1;
701+
CREATE TABLE t1 (a DATE);
702+
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
703+
SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00.1';
704+
a
705+
SELECT * FROM t1 WHERE LENGTH(a)=10;
706+
a
707+
2015-08-30
708+
2015-08-31
709+
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1';
710+
a
711+
EXPLAIN EXTENDED
712+
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1';
713+
id select_type table type possible_keys key key_len ref rows filtered Extra
714+
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
715+
Warnings:
716+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2015-08-30 00:00:00.1')
717+
EXPLAIN EXTENDED
718+
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00.1';
719+
id select_type table type possible_keys key key_len ref rows filtered Extra
720+
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
721+
Warnings:
722+
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())))
723+
DROP TABLE t1;
724+
CREATE TABLE t1 (a DATE);
725+
INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
726+
SELECT * FROM t1 WHERE a='2015-08-30 00:00:00';
727+
a
728+
2015-08-30
729+
SELECT * FROM t1 WHERE LENGTH(a)=10;
730+
a
731+
2015-08-30
732+
2015-08-31
733+
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00';
734+
a
735+
2015-08-30
736+
EXPLAIN EXTENDED
737+
SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00';
738+
id select_type table type possible_keys key key_len ref rows filtered Extra
739+
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
740+
Warnings:
741+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = DATE'2015-08-30')
742+
EXPLAIN EXTENDED
743+
SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='2015-08-30 00:00:00';
744+
id select_type table type possible_keys key key_len ref rows filtered Extra
745+
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
746+
Warnings:
747+
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())))
748+
DROP TABLE t1;
749+
SET timestamp=DEFAULT;
750+
#
597751
# End of 10.1 tests
598752
#

0 commit comments

Comments
 (0)