• Galina Shalygina's avatar
    MDEV-32608: Expression with constant subquery causes a crash in pushdown · a5e4c349
    Galina Shalygina authored
    from HAVING
    
    The bug is caused by refixing of the constant subquery in pushdown from
    HAVING into WHERE optimization.
    
    Similarly to MDEV-29363 in the problematic query two references of the
    constant subquery are used. After the pushdown one of the references of the
    subquery is pushed into WHERE-clause and the second one remains as the part
    of the HAVING-clause.
    Before the represented fix, the constant subquery reference that was going to
    be pushed into WHERE was cleaned up and fixed. That caused the changes of
    the subquery itself and, therefore, changes for the second reference that
    remained in HAVING. These changes caused a crash.
    
    To fix this problem all constant objects that are going to be pushed into
    WHERE should be marked with an IMMUTABLE_FL flag. Objects marked with this
    flag are not cleaned up or fixed in the pushdown optimization.
    
    Approved by Igor Babaev <igor@mariadb.com>
    a5e4c349
sql_lex.cc 348 KB