• Sreeharsha Ramanavarapu's avatar
    Bug #19434916: FATAL_SIGNAL IN ADD_KEY_EQUAL_FIELDS() WITH · 415faa12
    Sreeharsha Ramanavarapu authored
                   UPDATE VIEW USING OUTER SUBQUERY
    
    Issue:
    -----
    While resolving a column which refers to a table/view in an
    outer query, it's respecitve item object is marked with the
    outer query's select_lex object. But when the column refers
    to a view or if the column is part of a subquery in the
    HAVING clause, an Item_ref object is created. While the
    reference to the outer query is stored by the Item_ref
    object, the same is not stored in it's real_item.
    
    This creates a problem with the IN-TO-EXISTS optmization.
    When there is an index over the column in the inner query,
    it will be considered since the column's real_item object
    will be mistaken for a local field. This will lead to a
    crash.
    
    SOLUTION:
    ---------
    Under the current design, the only way to fix this issue is
    to check the reginfo.join_tab for a NULL value. If yes, the
    query should not be worrying about the key use.
    
    The testcase and comments added as part of the fix for
    Bug#17766653 have been backported.
    415faa12
sql_select.cc 579 KB