List:Commits« Previous MessageNext Message »
From:Dmitry Lenev Date:May 28 2009 3:14pm
Subject:bzr commit into mysql-6.1-fk branch (dlenev:2721) Bug#44925
View as plain text  
#At file:///home/dlenev/src/bzr/mysql-6.1-bg44925/ based on revid:dlenev@stripped

 2721 Dmitry Lenev	2009-05-28
      Fix for bug #44925 "Foreign keys: funcs_1.memory/myisam_views test
      failures".
      
      In mysql-6.1-fk tree tests memory_views and myisam_views in funcs_1
      suite were failing because CREATE TABLE statement failed to detect 
      that there is already existing view with the same name as table 
      being created in case when this view was processed with the help
      of derived table mechanism.
      
      In the process of implementing support for new foreign keys the way
      in which CREATE TABLE performs metadata and table locking was changed
      to be similar to how it is done in CREATE TABLE ... SELECT. 
      In particular, now it either opens and locks target table (i.e. one
      to be created) or obtains exclusive metadata lock on it. In cases
      when target table happened to be a view which was resolved through
      derived table, code responsible for derived table processing changed
      table_name member in element of table list representing target table
      to be the name of corresponding temporary table. And such a 'wrong'
      table name caused check for the target table existence which occured 
      later to return wrong results (i.e. that table didn't exist).
      
      This fix simply disables processing of derived tables when opening
      tables for ordinary CREATE TABLE. We are not using results of such 
      processing in any way and doing so allows to avoid 'corrupting'
      table list element for target table and therefore confusing code
      performing check for table existence.

    modified:
      sql/sql_table.cc
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2009-05-27 03:08:49 +0000
+++ b/sql/sql_table.cc	2009-05-28 15:14:22 +0000
@@ -5568,7 +5568,7 @@ bool mysql_create_table(THD *thd, TABLE_
     Open or obtain an exclusive metadata lock on table being created, also
     in --foreign-key-all-engines mode open and lock all parent tables.
   */
-  if (open_and_lock_tables_derived(thd, thd->lex->query_tables, TRUE,
+  if (open_and_lock_tables_derived(thd, thd->lex->query_tables, FALSE,
                                    MYSQL_OPEN_TAKE_UPGRADABLE_MDL))
   {
     result= TRUE;


Attachment: [text/bzr-bundle] bzr/dlenev@mysql.com-20090528151422-wfj1b5bz9f23xcqh.bundle
Thread
bzr commit into mysql-6.1-fk branch (dlenev:2721) Bug#44925Dmitry Lenev28 May