diff options
author | unknown <evgen@moonbone.local> | 2007-05-07 22:20:43 +0400 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2007-05-07 22:20:43 +0400 |
commit | 2d9c93ceb9d7b2874cee393c72c53b6685aeb6a4 (patch) | |
tree | 6b3495dbf37f71eb4ced3655dd3f9389071a103f /mysql-test/r/func_in.result | |
parent | 72f471c7429f41a351a3fbbe39a8447a242b0b74 (diff) | |
download | mariadb-git-2d9c93ceb9d7b2874cee393c72c53b6685aeb6a4.tar.gz |
Bug#28133: Wrong DATE/DATETIME comparison in IN() function.
The IN function was comparing DATE/DATETIME values either as ints or as
strings. Both methods have their disadvantages and may lead to a wrong
result.
Now IN function checks whether all of its arguments has the STRING result
types and at least one of them is a DATE/DATETIME item. If so it uses either
an object of the in_datetime class or an object of the cmp_item_datetime
class to perform its work. If the IN() function arguments are rows then
row columns are checked whether the DATE/DATETIME comparator should be used
to compare them.
The in_datetime class is used to find occurence of the item to be checked
in the vector of the constant DATE/DATETIME values. The cmp_item_datetime
class is used to compare items one by one in the DATE/DATETIME context.
Both classes obtain values from items with help of the get_datetime_value()
function and cache the left item if it is a constant one.
mysql-test/t/type_datetime.test:
Added a test case for the bug#28133: Wrong DATE/DATETIME comparison in IN() function.
mysql-test/r/type_datetime.result:
Added a test case for the bug#28133: Wrong DATE/DATETIME comparison in IN() function.
mysql-test/r/func_in.result:
A test case result is corrected after the fix for the bug#28133.
sql/item_cmpfunc.h:
Bug#28133: Wrong DATE/DATETIME comparison in IN() function.
Two DATE/DATETIME comparison classes are added.
The in_datetime class is used to find occurence of the item to be checked
in the vector of the constant DATE/DATETIME values. The cmp_item_datetime
class is used to compare items one by one in the DATE/DATETIME context.
Both classes obtain values from items with help of the get_datetime_value()
function and cache the left item if it is a constant one.
sql/item_cmpfunc.cc:
Bug#28133: Wrong DATE/DATETIME comparison in IN() function.
Now IN function checks whether all of its arguments has the STRING result
types and at least one of them is a DATE/DATETIME item. If so it uses either
an object of the in_datetime class or an object of the cmp_item_datetime
class to perform its work. If the IN() function arguments are rows then
row columns are checked whether the DATE/DATETIME comparator should be used
to compare them.
Diffstat (limited to 'mysql-test/r/func_in.result')
-rw-r--r-- | mysql-test/r/func_in.result | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index 87855091699..a3e0773649f 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -467,6 +467,7 @@ CREATE TABLE t4 (a DATE); INSERT INTO t4 VALUES ('1972-02-06'), ('1972-07-29'); SELECT * FROM t4 WHERE a IN ('1972-02-06','19772-07-29'); a +1972-02-06 Warnings: Warning 1292 Incorrect date value: '19772-07-29' for column 'a' at row 1 DROP TABLE t1,t2,t3,t4; |