diff options
author | unknown <igor@rurik.mysql.com> | 2006-04-08 11:42:09 -0700 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2006-04-08 11:42:09 -0700 |
commit | e536c8eca7eb528dfe8cfd5ca96d2772ccca2a86 (patch) | |
tree | 18e3045c143a5580aea80334fd3a56fdbd730c10 /sql | |
parent | 67cbda06b9dd5313f77c0d00d19c9cf49fcc11bc (diff) | |
download | mariadb-git-e536c8eca7eb528dfe8cfd5ca96d2772ccca2a86.tar.gz |
Fixed bug #16069.
The function agg_cmp_type in item_cmpfunc.cc neglected the fact that
the first argument in a BETWEEN/IN predicate could be a field of a view.
As a result in the case when the retrieved table was hidden by a view
over it and the arguments in the BETWEEN/IN predicates are of
the date/time type the function did not perform conversion of
the constant arguments to the same format as the first field argument.
If formats of the arguments differed it caused wrong a evaluation of
the predicates.
mysql-test/r/view.result:
Added a test case for bug #16069.
mysql-test/t/view.test:
Added a test case for bug #16069.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_cmpfunc.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 24075ac838d..6e1afd4ef09 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -55,8 +55,8 @@ static void agg_cmp_type(THD *thd, Item_result *type, Item **items, uint nitems) bool all_constant= TRUE; /* If the first argument is a FIELD_ITEM, pull out the field. */ - if (items[0]->type() == Item::FIELD_ITEM) - field=((Item_field *)items[0])->field; + if (items[0]->real_item()->type() == Item::FIELD_ITEM) + field=((Item_field *)(items[0]->real_item()))->field; /* But if it can't be compared as a longlong, we don't really care. */ if (field && !field->can_be_compared_as_longlong()) field= NULL; |