1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Bugfix: New table creation/renaming block added if old encoded table present.

mysql-test/r/create.result:
  test of renaming
mysql-test/r/upgrade.result:
  Now such behaviour prohibited to avoid problems.
mysql-test/t/create.test:
  test of renaming
mysql-test/t/upgrade.test:
  Now such behaviour prohibited to avoid problems.
sql/mysql_priv.h:
  Function to test table name presence added.
sql/sql_rename.cc:
  Rename fixed.
sql/sql_table.cc:
  Function to test table name presence added.
  Create fixed.
This commit is contained in:
unknown
2011-05-11 14:09:48 +03:00
parent e2ff288531
commit 520927a7df
7 changed files with 119 additions and 20 deletions

View File

@ -245,7 +245,7 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
char *new_table_alias, bool skip_error)
{
int rc= 1;
char name[FN_REFLEN + 1];
char new_name[FN_REFLEN + 1], old_name[FN_REFLEN + 1];
const char *new_alias, *old_alias;
frm_type_enum frm_type;
enum legacy_db_type table_type;
@ -264,17 +264,17 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
}
DBUG_ASSERT(new_alias);
build_table_filename(name, sizeof(name) - 1,
build_table_filename(new_name, sizeof(new_name) - 1,
new_db, new_alias, reg_ext, 0);
if (!access(name,F_OK))
build_table_filename(old_name, sizeof(old_name) - 1,
ren_table->db, old_alias, reg_ext, 0);
if (check_table_file_presence(old_name,
new_name, new_db, new_alias, new_alias, TRUE))
{
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_alias);
DBUG_RETURN(1); // This can't be skipped
}
build_table_filename(name, sizeof(name) - 1,
ren_table->db, old_alias, reg_ext, 0);
frm_type= mysql_frm_type(thd, name, &table_type);
frm_type= mysql_frm_type(thd, old_name, &table_type);
switch (frm_type)
{
case FRMTYPE_TABLE:
@ -319,7 +319,7 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
default:
DBUG_ASSERT(0); // should never happen
case FRMTYPE_ERROR:
my_error(ER_FILE_NOT_FOUND, MYF(0), name, my_errno);
my_error(ER_FILE_NOT_FOUND, MYF(0), old_name, my_errno);
break;
}
if (rc && !skip_error)