• Igor Babaev's avatar
    MDEV-27510 Query returns wrong result when using split optimization · 00412656
    Igor Babaev authored
    This bug may affect the queries that uses a grouping derived table with
    grouping list containing references to columns from different tables if
    the optimizer decides to employ the split optimization for the derived
    table. In some very specific cases it may affect queries with a grouping
    derived table that refers only one base table.
    This bug was caused by an improper fix for the bug MDEV-25128. The fix
    tried to get rid of the equality conditions pushed into the where clause
    of the grouping derived table T to which the split optimization had been
    applied. The fix erroneously assumed that only those pushed equalities
    that were used for ref access of the tables referenced by T were needed.
    In fact the function remove_const() that figures out what columns from the
    group list can be removed if the split optimization is applied can uses
    other pushed equalities as well.
    This patch actually provides a proper fix for MDEV-25128. Rather than
    trying to remove invalid pushed equalities referencing the fields of SJM
    tables with a look-up access the patch attempts not to push such equalities.
    
    Approved by Oleksandr Byelkin <sanja@mariadb.com>
    00412656
sql_select.h 82 KB