diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2012-01-20 02:11:53 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2012-01-20 02:11:53 +0400 |
commit | 9f60aa27f707dea88e8882c5aaf096dce35a3a72 (patch) | |
tree | b34dbc9872bdb7a2d090d1e144b20536a3fc5f7c /sql/item.cc | |
parent | 8bedf1ea1c328fabea14a1ce232794d73814b6d7 (diff) | |
download | mariadb-git-9f60aa27f707dea88e8882c5aaf096dce35a3a72.tar.gz |
BUG#912513: Wrong result (missing rows) with join_cache_hashed+materialization+semijoin=on
- equality substitution code was geared towards processing WHERE/ON clauses.
that is, it assumed that it was doing substitions on the code that
= wasn't attached to any particular join_tab yet
= was going to be fed to make_join_select() which would take the condition
apart and attach various parts of it to tables inside/outside semi-joins.
- However, somebody added equality substition for ref access. That is, if
we have a ref access on TBL.key=expr, they would do equality substition in
'expr'. This possibility wasn't accounted for.
- Fixed equality substition code by adding a mode that does equality
substition under assumption that the processed expression will be
attached to a certain particular table TBL.
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/item.cc b/sql/item.cc index d0608e392b3..aaf9b0c2a12 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -5023,7 +5023,8 @@ bool Item_field::set_no_const_sub(uchar *arg) Item *Item_field::replace_equal_field(uchar *arg) { - if (item_equal && item_equal == (Item_equal *) arg) + REPLACE_EQUAL_FIELD_ARG* param= (REPLACE_EQUAL_FIELD_ARG*)arg; + if (item_equal && item_equal == param->item_equal) { Item *const_item= item_equal->get_const(); if (const_item) @@ -5033,7 +5034,8 @@ Item *Item_field::replace_equal_field(uchar *arg) return this; return const_item; } - Item_field *subst= (Item_field *)(item_equal->get_first(this)); + Item_field *subst= + (Item_field *)(item_equal->get_first(param->context_tab, this)); if (subst) subst= (Item_field *) (subst->real_item()); if (subst && !field->eq(subst->field)) |