• Igor Babaev's avatar
    MDEV-25112 MIN/MAX aggregation over an indexed column may return wrong result · b34bb81e
    Igor Babaev authored
    If a query with implicit grouping contains in MIN/MAX set function in the
    select list over a column that is a part of an index then the query
    might be subject to MIN/MAX optimization. With this optimization the
    server performs a look-up into an index, fetches a value of the column C
    used in the MIN/MAX function and substitute the MIN/MAX expression for this
    value. This allows to eliminate the table containing C from further join
    processing. In order the optimization to be applied the WHERE condition
    must be a conjunction of simple equality/inequality predicates or/and
    BETWEEN predicates.
    The bug fixed in the patch resulted in fetching a wrong value from the
    index used for MIN/MAX optimization. It may happened when a BETWEEN
    predicate containing the MIN/MAX value followed a strict inequality.
    
    Approved by dmitry.shulga@mariadb.com
    b34bb81e
func_group.result 77.9 KB