mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 11:27:39 +02:00
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.
This commit is contained in:
parent
e4cdb58013
commit
729bcaf430
3 changed files with 30 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue