diff options
author | Igor Babaev <igor@askmonty.org> | 2011-04-26 19:58:41 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2011-04-26 19:58:41 -0700 |
commit | 8d9dd21d85e257051b45b2f779dcd9bf696bf9e1 (patch) | |
tree | 8a848ea3c6c25075015261314a0f2e128dee4149 /sql/opt_sum.cc | |
parent | bbd4bb310d7b500a57be56b8f0501fa8eee6d40f (diff) | |
download | mariadb-git-8d9dd21d85e257051b45b2f779dcd9bf696bf9e1.tar.gz |
Fixed LP bugs #717577, #724942.
Both these two bugs happened due to the following problem.
When a view column is referenced in the query an Item_direct_view_ref
object is created that is refers to the Item_field for the column.
All references to the same view column refer to the same Item_field.
Different references can belong to different AND/OR levels and,
as a result, can be included in different Item_equal object.
These Item_equal objects may include different constant objects.
If these constant objects are substituted for the Item_field created
for a view column we have a conflict situation when the second
substitution annuls the first substitution. This leads to
wrong result sets returned by the query. Bug #724942 demonstrates
such an erroneous behaviour.
Test case of the bug #717577 produces wrong result sets because best
equal fields of the multiple equalities built for different OR levels
of the WHERE condition differs. The subsitution for the best equal field
in the second OR branch overwrites the the substitution made for the
first branch.
To avoid such conflicts we have to substitute for the references
to the view columns rather than for the underlying field items.
To make such substitutions possible we have to include into
multiple equalities references to view columns rather than
field items created for such columns.
This patch modifies the Item_equal class to include references
to view columns into multiple equality objects. It also performs
a clean up of the class methods and adds more comments. The methods
of the Item_direct_view_ref class that assist substitutions for
references to view columns has been also added by this patch.
Diffstat (limited to 'sql/opt_sum.cc')
-rw-r--r-- | sql/opt_sum.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index 450ded89653..43887c84b75 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -473,7 +473,7 @@ bool simple_pred(Item_func *func_item, Item **args, bool *inv_order) /* MULT_EQUAL_FUNC */ { Item_equal *item_equal= (Item_equal *) func_item; - Item_equal_iterator it(*item_equal); + Item_equal_fields_iterator it(*item_equal); args[0]= it++; if (it++) return 0; |