• unknown's avatar
    Bug#21136 CREATE TABLE SELECT within CREATE TABLE SELECT causes server crash · 6e668b4f
    unknown authored
    When CREATE TEMPORARY TABLE .. SELECT is invoked from a stored function
    which in turn is called from CREATE TABLE SELECT causes a memory leak
    because the inner create temporary table overrides the outter extra_lock
    reference when locking the table.
    
    The solution is to simply not overrride the extra_lock by only using the
    extra_lock for a non-temporary table lock.
    
    
    mysql-test/r/create.result:
      Add test case result for Bug#21136
    mysql-test/t/create.test:
      Add test case for Bug#21136
    sql/sql_insert.cc:
      For temporary tables, store the lock data within the select_create class
      since tmp tables contents are not replicated. For "real" tables, store
      the lock data in the thread extra_lock pointer.
    6e668b4f
create.result 100 KB