• Sreeharsha Ramanavarapu's avatar
    Bug #28499924: INCORRECT BEHAVIOR WITH UNION IN SUBQUERY · b20d94da
    Sreeharsha Ramanavarapu authored
    Issue:
    ------
    When a subquery contains UNION the count of the number of
    subquery columns is calculated incorrectly. Only the first
    query block in the subquery's UNION is considered and an
    array indexing goes out-of-bounds, and this is caught by an
    assert.
    
    Solution:
    ---------
    Sum up the columns from all query blocks of the query
    expression.
    
    Change specific to 5.6/5.5:
    ---------------------------
    The "child" points to the last query block of the UNION
    (as opposed to 5.7+ where it points to the first member of
    UNION). So "child->master_unit()->first_select()" is used
    to reach the first query block of UNION.
    b20d94da
sql_yacc.yy 453 KB