• Igor Babaev's avatar
    MDEV-31277 Wrong result on 2-nd execution of PS to select from view using derived · d57c44f6
    Igor Babaev authored
    As a result of this bug the second execution of the prepared statement
    created for select from materialized view could return a wrong result set if
    - the specification of the view used a left join
    - an inner table the left join was a mergeable derived table
    - the derived table contained a constant column.
    
    The problem appeared because the flag 'maybe-null' of the wrapper
    Item_direct_view_ref constructed for the constant field of the mergeable
    derived table was not set to 'true' on the second execution of the
    prepared statement.
    
    The patch always sets this flag properly when calling the function
    Item_direct_view_ref::set_null_ref-table(). The latter is invoked in
    Item_direct_view_ref constructor if it is created for some reference of
    a constant column belonging to a mergeable derived table.
    
    Approved by Oleksandr Byelkin <sanja@mariadb.com>
    d57c44f6
derived_view.result 151 KB