mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Fix bug #14093 Query takes a lot of time when date format is not valid
Invalid date like 2000-02-32 wasn't converted to int, which lead to not using index and comparison with field as astring, which results in slow query execution. convert_constatn_item() and get_mm_leaf() now forces MODE_INVALID_DATES to allow such conversion.
This commit is contained in:
@ -3193,3 +3193,43 @@ a b c
|
||||
select * from t1 join t2 straight_join t3 on (t1.a=t3.c);
|
||||
a b c
|
||||
drop table t1, t2 ,t3;
|
||||
create table t1(f1 int, f2 date);
|
||||
insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'),
|
||||
(4,'2005-10-01'),(5,'2005-12-30');
|
||||
select * from t1 where f2 >= 0;
|
||||
f1 f2
|
||||
1 2005-01-01
|
||||
2 2005-09-01
|
||||
3 2005-09-30
|
||||
4 2005-10-01
|
||||
5 2005-12-30
|
||||
select * from t1 where f2 >= '0000-00-00';
|
||||
f1 f2
|
||||
1 2005-01-01
|
||||
2 2005-09-01
|
||||
3 2005-09-30
|
||||
4 2005-10-01
|
||||
5 2005-12-30
|
||||
select * from t1 where f2 >= '2005-09-31';
|
||||
f1 f2
|
||||
4 2005-10-01
|
||||
5 2005-12-30
|
||||
select * from t1 where f2 >= '2005-09-3a';
|
||||
f1 f2
|
||||
4 2005-10-01
|
||||
5 2005-12-30
|
||||
Warnings:
|
||||
Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1
|
||||
select * from t1 where f2 <= '2005-09-31';
|
||||
f1 f2
|
||||
1 2005-01-01
|
||||
2 2005-09-01
|
||||
3 2005-09-30
|
||||
select * from t1 where f2 <= '2005-09-3a';
|
||||
f1 f2
|
||||
1 2005-01-01
|
||||
2 2005-09-01
|
||||
3 2005-09-30
|
||||
Warnings:
|
||||
Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 1
|
||||
drop table t1;
|
||||
|
@ -2702,3 +2702,21 @@ select * from t1 join t2 left join t3 on (t1.a=t3.c);
|
||||
select * from t1 join t2 right join t3 on (t1.a=t3.c);
|
||||
select * from t1 join t2 straight_join t3 on (t1.a=t3.c);
|
||||
drop table t1, t2 ,t3;
|
||||
|
||||
#
|
||||
# Bug #14093 Query takes a lot of time when date format is not valid
|
||||
# fix optimizes execution. so here we just check that returned set is
|
||||
# correct.
|
||||
create table t1(f1 int, f2 date);
|
||||
insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'),
|
||||
(4,'2005-10-01'),(5,'2005-12-30');
|
||||
# should return all records
|
||||
select * from t1 where f2 >= 0;
|
||||
select * from t1 where f2 >= '0000-00-00';
|
||||
# should return 4,5
|
||||
select * from t1 where f2 >= '2005-09-31';
|
||||
select * from t1 where f2 >= '2005-09-3a';
|
||||
# should return 1,2,3
|
||||
select * from t1 where f2 <= '2005-09-31';
|
||||
select * from t1 where f2 <= '2005-09-3a';
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user