1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Fix error message generated when trying to create a table in a

non-existent database. (Bug #10407)


mysql-test/r/create.result:
  Update results
mysql-test/t/create.test:
  Update error numbers
sql/mysql_priv.h:
  Adjust some other function signature so table and db information
  is passed down into create_frm().
sql/sql_table.cc:
  Check for database not existing after hitting an error when
  copying the .frm file for 'CREATE TABLE ... LIKE ...', and
  pass table and db name into rea_create_table().
sql/table.cc:
  Generate specific error message when .frm creation fails because
  the database does not exist.
sql/unireg.cc:
  Pass database and table name down into create_frm().
This commit is contained in:
unknown
2005-07-21 20:08:54 -07:00
parent 31ebc6ef71
commit 4198410528
6 changed files with 38 additions and 16 deletions

View File

@@ -1418,12 +1418,10 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
create_info->data_file_name= create_info->index_file_name= 0;
create_info->table_options=db_options;
if (rea_create_table(thd, path, create_info, fields, key_count,
if (rea_create_table(thd, path, table_name, db,
create_info, fields, key_count,
key_info_buffer))
{
/* my_error(ER_CANT_CREATE_TABLE,MYF(0),table_name,my_errno); */
goto end;
}
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
/* Open table and put in temporary table list */
@@ -2366,8 +2364,14 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
/*
Create a new table by copying from source table
*/
if (my_copy(src_path, dst_path, MYF(MY_WME|MY_DONT_OVERWRITE_FILE)))
if (my_copy(src_path, dst_path, MYF(MY_DONT_OVERWRITE_FILE)))
{
if (my_errno == ENOENT)
my_error(ER_BAD_DB_ERROR,MYF(0),db);
else
my_error(ER_CANT_CREATE_FILE,MYF(0),dst_path,my_errno);
goto err;
}
/*
As mysql_truncate don't work on a new table at this stage of