diff options
author | Jon Olav Hauglid <jon.hauglid@oracle.com> | 2010-07-07 14:18:20 +0200 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@oracle.com> | 2010-07-07 14:18:20 +0200 |
commit | 24484791a276bab317c727d21058e85740c34291 (patch) | |
tree | 4be06980c0aada33fd269c1ccb9d1be7a0e675ab /sql | |
parent | 6516efebb732e6b491b7ea8da4ebd214e5243456 (diff) | |
parent | 223f42b7158fee3b2464e76654142c7cd55a415e (diff) | |
download | mariadb-git-24484791a276bab317c727d21058e85740c34291.tar.gz |
manual merge from mysql-5.1-security
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_table.cc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 902e7fa7b5f..d52e5e0f3e9 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -7331,12 +7331,22 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, if (table->s->tmp_table != NO_TMP_TABLE) { /* Close lock if this is a transactional table */ - if (thd->lock && - ! (thd->locked_tables_mode == LTM_LOCK_TABLES || - thd->locked_tables_mode == LTM_PRELOCKED_UNDER_LOCK_TABLES)) + if (thd->lock) { - mysql_unlock_tables(thd, thd->lock); - thd->lock=0; + if (thd->locked_tables_mode != LTM_LOCK_TABLES && + thd->locked_tables_mode != LTM_PRELOCKED_UNDER_LOCK_TABLES) + { + mysql_unlock_tables(thd, thd->lock); + thd->lock=0; + } + else + { + /* + If LOCK TABLES list is not empty and contains this table, + unlock the table and remove the table from this list. + */ + mysql_lock_remove(thd, thd->lock, table); + } } /* Remove link to old table and rename the new one */ close_temporary_table(thd, table, 1, 1); |