diff options
author | unknown <igor@olga.mysql.com> | 2007-03-09 01:45:32 -0800 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-03-09 01:45:32 -0800 |
commit | 729bcaf430d3c41606611b87b976645e1e744b04 (patch) | |
tree | c14c007735ea1a3f5b637d3dec24b746c086a1c1 /sql/item.cc | |
parent | e4cdb5801325acf72dbbe197c3c2eb2f7c7244b7 (diff) | |
download | mariadb-git-729bcaf430d3c41606611b87b976645e1e744b04.tar.gz |
Fixed bug #26661: crash when order by clause in a union
construct references invalid name.
Derived tables currently cannot use outer references.
Thus there is no outer context for them.
The 4.1 code takes this fact into account while the
Item_field::fix_outer_field code of 5.0 lost the check that blocks
any attempts to resolve names in outer context for derived tables.
mysql-test/r/union.result:
Added a test case for bug #26661.
mysql-test/t/union.test:
Added a test case for bug #26661.
sql/item.cc:
Fixed bug #26661.
Derived tables currently cannot use outer references.
Thus there is no outer context for them.
The 4.1 code takes this fact into account while the
Item_field::fix_outer_field code of 5.0 lost the check that blocks
any attempts to resolve names in outer context for derived tables.
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc index c5d8a62761c..80c3311b2a7 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -3441,7 +3441,12 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference) */ Name_resolution_context *last_checked_context= context; Item **ref= (Item **) not_found_item; - Name_resolution_context *outer_context= context->outer_context; + SELECT_LEX *current_sel= (SELECT_LEX *) thd->lex->current_select; + Name_resolution_context *outer_context= 0; + /* Currently derived tables cannot be correlated */ + if (current_sel->master_unit()->first_select()->linkage != + DERIVED_TABLE_TYPE) + outer_context= context->outer_context; for (; outer_context; outer_context= outer_context->outer_context) |