At file:///home/psergey/dev/maria-5.3-subqueries-r3/ ------------------------------------------------------------ revno: 2754 revision-id: psergey@askmonty.org-20100208131019-q3vmltpo7vu9ihz6 parent: psergey@askmonty.org-20100208130923-g38q4uiyu90g60w9 committer: Sergey Petrunya <psergey@askmonty.org> branch nick: maria-5.3-subqueries-r3 timestamp: Mon 2010-02-08 15:10:19 +0200 message: Subquery backport: pass the correct item (the one that was resolved in ancestor select and has item->fixed==1) to mark_as_dependent === modified file 'sql/item.cc' --- a/sql/item.cc 2010-02-08 09:56:16 +0000 +++ b/sql/item.cc 2010-02-08 13:10:19 +0000 @@ -3643,7 +3643,9 @@ @param current current select @param resolved_item item which was resolved in outer SELECT(for warning) @param mark_item item which should be marked (can be differ in case of - substitution) + substitution) And also different when accessing VIEW + columns: in that case its Item_..._view_ref while + resolved_item is Item_field. */ static bool mark_as_dependent(THD *thd, SELECT_LEX *last, SELECT_LEX *current, @@ -3657,7 +3659,7 @@ /* store pointer on SELECT_LEX from which item is dependent */ if (mark_item) mark_item->depended_from= last; - if (current->mark_as_dependent(thd, last, resolved_item)) + if (current->mark_as_dependent(thd, last, /*resolved_item*/ mark_item)) //psergey-fix2 return TRUE; if (thd->lex->describe & DESCRIBE_EXTENDED) {