• dlenev@mockturtle.local's avatar
    5.1 version of fix for: · 8e8f4c05
    dlenev@mockturtle.local authored
      Bug #23667 "CREATE TABLE LIKE is not isolated from alteration
                  by other connections"
      Bug #18950 "CREATE TABLE LIKE does not obtain LOCK_open"
    As well as:
      Bug #25578 "CREATE TABLE LIKE does not require any privileges
                  on source table".
    
    The first and the second bugs resulted in various errors and wrong
    binary log order when one tried to execute concurrently CREATE TABLE LIKE
    statement and DDL statements on source table or DML/DDL statements on its
    target table.
    
    The problem was caused by incomplete protection/table-locking against
    concurrent statements implemented in mysql_create_like_table() routine.
    We solve it by simply implementing such protection in proper way.
    Most of actual work for 5.1 was already done by fix for bug 20662 and
    preliminary patch changing locking in ALTER TABLE.
    
    The third bug allowed user who didn't have any privileges on table create
    its copy and therefore circumvent privilege check for SHOW CREATE TABLE.
    
    This patch solves this problem by adding privilege check, which was missing.
    
    Finally it also removes some duplicated code from mysql_create_like_table()
    and thus fixes bug #26869 "TABLE_LIST::table_name_length inconsistent with
    TABLE_LIST::table_name".
    8e8f4c05
disabled.def 2.78 KB