• Jon Olav Hauglid's avatar
    Backport from mysql-6.0-codebase of: · be3005d9
    Jon Olav Hauglid authored
    ------------------------------------------------------------
    revno: 3672
    committer: lars-erik.bjork@sun.com
    branch nick: 48067-mysql-6.0-codebase-bugfixing
    timestamp: Mon 2009-10-26 13:51:43 +0100
    message:
      This is a patch for bug#48067
      "A temp table with the same name as an existing table, makes drop
      database fail"
            
      When dropping the database, mysql_rm_known_files() reads the contents
      of the database directory, and creates a TABLE_LIST object, for each
      .frm file encountered. Temporary tables, however, are not associated 
      with any .frm file.
            
      The list of tables to drop are passed to mysql_rm_table_part2().
      This method prefers temporary tables over regular tables, so if
      there is a temporary table with the same name as a regular, the
      temporary is removed, leaving the regular table intact.
      Regular tables are only deleted if there are no temporary tables
      with the same name.
            
      This fix ensures, that for all TABLE_LIST objects that are created
      by mysql_rm_known_files(), 'open_type' is set to 'OT_BASE_ONLY', to
      indicate that this is a regular table. In all cases in
      mysql_rm_table_part2() where we prefer a temporary table to a
      non-temporary table, we chek if 'open_type' equals 'OT_BASE_ONLY'.
    be3005d9
temp_table.test 6.44 KB