bugfix: PS and dependent subqueries
when there are nested subqueries, and a field in a subquery is resolved as an outer reference to a table few levels up, all subqueries the subquery with a reference and all subqueries up to subquery with the table must be marked as dependent. in the text protocol and PS-prepare step it happens in Item_field::fix_outer_field in a loop that walks contexts using context->outer_context. in PS-execute step Item_field->cached_table is set and subqueries are walked in a PS-only mark_select_range_as_dependent(), which inconsistently walks SELECT_LEX'es using select_lex->outer_select(). Fix mark_select_range_as_dependent() to walk contexts, not SELECT_LEX'es, to have the same logic both in prepare and execute steps. This fixes a crash in main.insert_returning in --ps-protocol
Showing
Please register or sign in to comment