• Aleksey Midenkov's avatar
    MDEV-21155 Assertion with versioned table upon DELETE from view of view after replacing first view · 6dd41e00
    Aleksey Midenkov authored
    When view is merged by DT_MERGE_FOR_INSERT it is then skipped from
    processing and doesn't update WHERE clause with
    vers_setup_conds(). Note that view itself cannot work in
    vers_setup_conds() because it doesn't have row_start, row_end
    fields. Thus it is required to descend down to material TABLE_LIST
    through calls of mysql_derived_prepare() and run vers_setup_conds()
    from there. Luckily, all views (views of views, views of views of
    views, etc.) are linked in one list through next_global pointer, so we
    can skip all views of views and get straight to non-view TABLE_LIST by
    checking its merge_underlying_list property for zero value (it is
    assigned by DT_MERGE_FOR_INSERT for merged derived tables).
    
    We have to do that only for UPDATE and DELETE. Other DML commands
    don't use WHERE clause.
    
    MDEV-21146 Assertion `m_lock_type == 2' in handler::ha_drop_table upon LOAD DATA
    
    LOAD DATA does not use WHERE and the above call of vers_setup_conds()
    is not needed. unit->prepare() led to wrongly locked temporary table.
    6dd41e00
view.result 9.41 KB