• Jon Olav Hauglid's avatar
    Backport of revno: 2617.68.43 · 0b874e3e
    Jon Olav Hauglid authored
    Bug #47335 assert in get_table_share
    
    The assert would happen if ALTER VIEW was used to alter a view (existing 
    or non-existing) and a temporary table with the same name already existed.
    
    The assert is triggered if the current statement does not have a MDL lock on 
    the view to be altered. This would happen because open_table() would open 
    the temporary table instead and MDL locks are not taken for temporary 
    tables (since they are local to one connection).
    
    The patch changes open_type for CREATE/ALTER VIEW to OT_BASE_ONLY. This prevents 
    open_table() from trying to open a temporary table with the same name should
    one exist. Now the view will be altered if it exists or ER_NO_SUCH_TABLE will
    be reported if it does not.
    
    Test case added to view.test
    0b874e3e
view.result 116 KB