diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2011-05-10 21:59:51 +0100 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2011-05-10 21:59:51 +0100 |
commit | 30575353b6c9864afd580811d289260d1dc844d0 (patch) | |
tree | 2a2e962015b0d7fc84bfa54e87fe4c306b9093dd /sql/sql_select.cc | |
parent | e843297d128b165125d17aab8958f7ca91808923 (diff) | |
download | mariadb-git-30575353b6c9864afd580811d289260d1dc844d0.tar.gz |
BUG#779885: Crash in eliminate_item_equal with materialization=on in maria-5.3
- In eliminate_item_equal(), we could end up in a situation where:
= The multiple equality has a constant C1 (and so it is the "head item")
= The join order was such that we've generated "sj_inner_table1=C1" equality,
and now are looking to generate "sj_inner_table2_=..." equality.
When looking for what should be the other member of equality, we run
Item *head_item= current_sjm? current_sjm_head: head;
which sees current_sjm!=NULL, and takes current_sjm_head (which is NULL because
the constant C1 is the head for all cases).
- Fixed in a trivial way: take current_sjm_head if we don't have constant.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 5e84138bf9c..2d2f556ded7 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -10160,8 +10160,16 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels, { if (eq_item) eq_list.push_back(eq_item); + + /* + If we're inside an SJM-nest (current_sjm!=NULL), and the multi-equality + doesn't include a constant, we should produce equality with the first + of the equals in this SJM. - Item *head_item= current_sjm? current_sjm_head: head; + In other cases, get the "head" item, which is either first of the + equals on top level, or the constant. + */ + Item *head_item= (!item_const && current_sjm)? current_sjm_head: head; Item *head_real_item= head_item->real_item(); if (head_real_item->type() == Item::FIELD_ITEM) head_item= head_real_item; |