mirror of
https://github.com/MariaDB/server.git
synced 2026-04-26 10:15:29 +02:00
Fix for bug#49199: Optimizer handles incorrectly:
field='const1' AND field='const2' in some cases
Building multiple equality predicates containing
a constant which is compared as a datetime (with a field)
we should take this fact into account and compare the
constant with another possible constatns as datetimes
as well.
E.g. for the
SELECT ... WHERE a='2001-01-01' AND a='2001-01-01 00:00:00'
we should compare '2001-01-01' with '2001-01-01 00:00:00' as
datetimes but not as strings.
mysql-test/r/select.result:
Fix for bug#49199: Optimizer handles incorrectly:
field='const1' AND field='const2' in some cases
- test result.
mysql-test/t/select.test:
Fix for bug#49199: Optimizer handles incorrectly:
field='const1' AND field='const2' in some cases
- test case.
sql/item_cmpfunc.cc:
Fix for bug#49199: Optimizer handles incorrectly:
field='const1' AND field='const2' in some cases
- adding a constant to Item_equal compare it as
a datetime value with stored one if there's a
date[time] field in a equality predicate.
sql/item_cmpfunc.h:
Fix for bug#49199: Optimizer handles incorrectly:
field='const1' AND field='const2' in some cases
- adding a constant to Item_equal compare it as
a datetime value with stored one if there's a
date[time] field in a equality predicate.
sql/sql_select.cc:
Fix for bug#49199: Optimizer handles incorrectly:
field='const1' AND field='const2' in some cases
- adding a constant to Item_equal compare it as
a datetime value with stored one if there's a
date[time] field in a equality predicate.
This commit is contained in:
parent
026541c662
commit
f5b51bc1e2
5 changed files with 178 additions and 7 deletions
|
|
@ -1477,7 +1477,9 @@ class Item_equal: public Item_bool_func
|
|||
List<Item_field> fields; /* list of equal field items */
|
||||
Item *const_item; /* optional constant item equal to fields items */
|
||||
cmp_item *eval_item;
|
||||
Arg_comparator cmp;
|
||||
bool cond_false;
|
||||
bool compare_as_dates;
|
||||
public:
|
||||
inline Item_equal()
|
||||
: Item_bool_func(), const_item(0), eval_item(0), cond_false(0)
|
||||
|
|
@ -1486,6 +1488,8 @@ public:
|
|||
Item_equal(Item *c, Item_field *f);
|
||||
Item_equal(Item_equal *item_equal);
|
||||
inline Item* get_const() { return const_item; }
|
||||
void compare_const(Item *c);
|
||||
void add(Item *c, Item_field *f);
|
||||
void add(Item *c);
|
||||
void add(Item_field *f);
|
||||
uint members();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue