• Igor Babaev's avatar
    MDEV-31361 Wrong result on 2nd execution of PS for query with derived table · 6fadbf8e
    Igor Babaev authored
    This bug led to wrong result sets returned by the second execution of
    prepared statements from selects using mergeable derived tables pushed
    into external engine. Such derived tables are always materialized. The
    decision that they have to be materialized is taken late in the function
    mysql_derived_optimized(). For regular derived tables this decision is
    usually taken at the prepare phase. However in some cases for some derived
    tables this decision is made in mysql_derived_optimized() too. It can be
    seen in the code of mysql_derived_fill() that for such a derived table it's
    critical to change its translation table to tune it to the fields of the
    temporary table used for materialization of the derived table and this
    must be done after each refill of the derived table. The same actions are
    needed for derived tables pushed into external engines.
    
    Approved by Oleksandr Byelkin <sanja@mariadb.com>
    6fadbf8e
sql_derived.cc 52.8 KB