• unknown's avatar
    Fix MySQL BUG#12329653 · 1eb2eb4b
    unknown authored
    In MariaDB, when running in ONLY_FULL_GROUP_BY mode,
    the server produced in incorrect error message that there
    is an aggregate function without GROUP BY, for artificially
    created MIN/MAX functions during subquery MIN/MAX optimization.
    
    The fix introduces a way to distinguish between artifially
    created MIN/MAX functions as a result of a rewrite, and normal
    ones present in the query. The test for ONLY_FULL_GROUP_BY violation
    now tests in addition if a MIN/MAX function was part of a MIN/MAX
    subquery rewrite.
    
    In order to be able to distinguish these MIN/MAX functions, the
    patch introduces an additional flag in Item_in_subselect::in_strategy -
    SUBS_STRATEGY_CHOSEN. This flag is set when the optimizer makes its
    final choice of a subuqery strategy. In order to make the choice
    consistent, access to Item_in_subselect::in_strategy is provided
    via new class methods.
    ******
    Fix MySQL BUG#12329653
    
    In MariaDB, when running in ONLY_FULL_GROUP_BY mode,
    the server produced in incorrect error message that there
    is an aggregate function without GROUP BY, for artificially
    created MIN/MAX functions during subquery MIN/MAX optimization.
    
    The fix introduces a way to distinguish between artifially
    created MIN/MAX functions as a result of a rewrite, and normal
    ones present in the query. The test for ONLY_FULL_GROUP_BY violation
    now tests in addition if a MIN/MAX function was part of a MIN/MAX
    subquery rewrite.
    
    In order to be able to distinguish these MIN/MAX functions, the
    patch introduces an additional flag in Item_in_subselect::in_strategy -
    SUBS_STRATEGY_CHOSEN. This flag is set when the optimizer makes its
    final choice of a subuqery strategy. In order to make the choice
    consistent, access to Item_in_subselect::in_strategy is provided
    via new class methods.
    1eb2eb4b
opt_subselect.cc 162 KB