summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2008-01-18 22:50:36 +0300
committerunknown <sergefp@mysql.com>2008-01-18 22:50:36 +0300
commitc71a6428d822f60932e5cea0d395a06d777d2b9c (patch)
tree2b98b6b8eb52a5a4d644a37d6c735aac143342f6 /sql/sql_select.cc
parentec25326975a0dea51be201d1b92dcc1a44bd03da (diff)
downloadmariadb-git-c71a6428d822f60932e5cea0d395a06d777d2b9c.tar.gz
BUG#33794 "MySQL crashes executing specific query":
The problem occurred when one had a subquery that had an equality X=Y where Y referred to a named select list expression from the parent select. MySQL crashed when trying to use the X=Y equality for ref-based access. Fixed by allowing non-Item_field items in the described case. mysql-test/r/subselect.result: BUG#33794 "MySQL crashes executing specific query" - Testcase mysql-test/t/subselect.test: BUG#33794 "MySQL crashes executing specific query" - Testcase sql/sql_select.cc: BUG#33794 "MySQL crashes executing specific query" get_store_key() assumed that if it got a reference t.key=Item_outer_ref(Item_direct_ref(x)) then x was an Item_field object, which is not the case when one refers to a named select list expression out ot subquery.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 17b6a4a44ab..87935b5548f 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -5379,7 +5379,8 @@ get_store_key(THD *thd, KEYUSE *keyuse, table_map used_tables,
(keyuse->val->type() == Item::REF_ITEM &&
((Item_ref*)keyuse->val)->ref_type() == Item_ref::OUTER_REF &&
(*(Item_ref**)((Item_ref*)keyuse->val)->ref)->ref_type() ==
- Item_ref::DIRECT_REF) )
+ Item_ref::DIRECT_REF &&
+ keyuse->val->real_item()->type() == Item::FIELD_ITEM))
return new store_key_field(thd,
key_part->field,
key_buff + maybe_null,