Below is the list of changes that have just been committed into a local
4.1 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2333 05/07/21 20:08:54 jimw@stripped +6 -0
Fix error message generated when trying to create a table in a
non-existent database. (Bug #10407)
sql/unireg.cc
1.48 05/07/21 20:08:45 jimw@stripped +9 -3
Pass database and table name down into create_frm().
sql/table.cc
1.130 05/07/21 20:08:45 jimw@stripped +10 -2
Generate specific error message when .frm creation fails because
the database does not exist.
sql/sql_table.cc
1.295 05/07/21 20:08:45 jimw@stripped +9 -5
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/mysql_priv.h
1.359 05/07/21 20:08:45 jimw@stripped +6 -2
Adjust some other function signature so table and db information
is passed down into create_frm().
mysql-test/t/create.test
1.55 05/07/21 20:08:45 jimw@stripped +2 -2
Update error numbers
mysql-test/r/create.result
1.83 05/07/21 20:08:45 jimw@stripped +2 -2
Update results
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jimw
# Host: rama.(none)
# Root: /home/jimw/my/mysql-4.1-10407
--- 1.358/sql/mysql_priv.h 2005-07-20 18:53:17 -07:00
+++ 1.359/sql/mysql_priv.h 2005-07-21 20:08:45 -07:00
@@ -1029,10 +1029,13 @@
void unireg_init(ulong options);
void unireg_end(void);
bool mysql_create_frm(THD *thd, my_string file_name,
+ const char *table, const char* db,
HA_CREATE_INFO *create_info,
List<create_field> &create_field,
uint key_count,KEY *key_info,handler *db_type);
-int rea_create_table(THD *thd, my_string file_name,HA_CREATE_INFO *create_info,
+int rea_create_table(THD *thd, my_string file_name,
+ const char *table, const char* db,
+ HA_CREATE_INFO *create_info,
List<create_field> &create_field,
uint key_count,KEY *key_info);
int format_number(uint inputflag,uint max_length,my_string pos,uint length,
@@ -1104,7 +1107,8 @@
const char *newname);
ulong next_io_size(ulong pos);
void append_unescaped(String *res, const char *pos, uint length);
-int create_frm(char *name,uint reclength,uchar *fileinfo,
+int create_frm(char *name, const char *table, const char *db,
+ uint reclength,uchar *fileinfo,
HA_CREATE_INFO *create_info, uint keys);
void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form);
int rename_file_ext(const char * from,const char * to,const char * ext);
--- 1.294/sql/sql_table.cc 2005-07-20 19:30:26 -07:00
+++ 1.295/sql/sql_table.cc 2005-07-21 20:08:45 -07:00
@@ -1418,12 +1418,10 @@
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 @@
/*
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
--- 1.129/sql/table.cc 2005-05-18 10:40:35 -07:00
+++ 1.130/sql/table.cc 2005-07-21 20:08:45 -07:00
@@ -1238,7 +1238,8 @@
/* Create a .frm file */
-File create_frm(register my_string name, uint reclength, uchar *fileinfo,
+File create_frm(register my_string name, const char *table, const char *db,
+ uint reclength, uchar *fileinfo,
HA_CREATE_INFO *create_info, uint keys)
{
register File file;
@@ -1263,7 +1264,7 @@
*/
set_if_smaller(create_info->raid_chunks, 255);
- if ((file= my_create(name, CREATE_MODE, create_flags, MYF(MY_WME))) >= 0)
+ if ((file= my_create(name, CREATE_MODE, create_flags, MYF(0))) >= 0)
{
bzero((char*) fileinfo,64);
fileinfo[0]=(uchar) 254; fileinfo[1]= 1; fileinfo[2]= FRM_VER+3; // Header
@@ -1299,6 +1300,13 @@
return(-1);
}
}
+ }
+ else
+ {
+ if (my_errno == ENOENT)
+ my_error(ER_BAD_DB_ERROR,MYF(0),db);
+ else
+ my_error(ER_CANT_CREATE_TABLE,MYF(0),table,my_errno);
}
return (file);
} /* create_frm */
--- 1.47/sql/unireg.cc 2005-05-18 12:58:36 -07:00
+++ 1.48/sql/unireg.cc 2005-07-21 20:08:45 -07:00
@@ -56,6 +56,8 @@
mysql_create_frm()
thd Thread handler
file_name Name of file (including database and .frm)
+ table Name of table
+ db Name of database
create_info create info parameters
create_fields Fields to create
keys number of keys to create
@@ -68,6 +70,7 @@
*/
bool mysql_create_frm(THD *thd, my_string file_name,
+ const char *table, const char *db,
HA_CREATE_INFO *create_info,
List<create_field> &create_fields,
uint keys, KEY *key_info,
@@ -114,7 +117,7 @@
reclength=uint2korr(forminfo+266);
null_fields=uint2korr(forminfo+282);
- if ((file=create_frm(file_name, reclength, fileinfo,
+ if ((file=create_frm(file_name, table, db, reclength, fileinfo,
create_info, keys)) < 0)
{
my_free((gptr) screen_buff,MYF(0));
@@ -213,9 +216,11 @@
Create a frm (table definition) file and the tables
SYNOPSIS
- mysql_create_frm()
+ rea_create_table()
thd Thread handler
file_name Name of file (including database and .frm)
+ table Name of table
+ db Name of database
create_info create info parameters
create_fields Fields to create
keys number of keys to create
@@ -228,13 +233,14 @@
*/
int rea_create_table(THD *thd, my_string file_name,
+ const char *table, const char *db,
HA_CREATE_INFO *create_info,
List<create_field> &create_fields,
uint keys, KEY *key_info)
{
DBUG_ENTER("rea_create_table");
- if (mysql_create_frm(thd, file_name, create_info,
+ if (mysql_create_frm(thd, file_name, table, db, create_info,
create_fields, keys, key_info, NULL))
DBUG_RETURN(1);
if (ha_create_table(file_name,create_info,0))
--- 1.82/mysql-test/r/create.result 2005-06-09 08:06:00 -07:00
+++ 1.83/mysql-test/r/create.result 2005-07-21 20:08:45 -07:00
@@ -37,7 +37,7 @@
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary
key (ord,ordid)) engine=heap;
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be
defined as a key
create table not_existing_database.test (a int);
-Got one of the listed errors
+ERROR 42000: Unknown database 'not_existing_database'
create table `a/a` (a int);
ERROR 42000: Incorrect table name 'a/a'
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
@@ -342,7 +342,7 @@
create table t3 like mysqltest.t3;
ERROR 42S01: Table 't3' already exists
create table non_existing_database.t1 like t1;
-Got one of the listed errors
+ERROR 42000: Unknown database 'non_existing_database'
create table t3 like non_existing_table;
ERROR 42S02: Unknown table 'non_existing_table'
create temporary table t3 like t1;
--- 1.54/mysql-test/t/create.test 2005-06-09 08:06:00 -07:00
+++ 1.55/mysql-test/t/create.test 2005-07-21 20:08:45 -07:00
@@ -39,7 +39,7 @@
--error 1075
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary
key (ord,ordid)) engine=heap;
--- error 1044,1
+-- error 1049
create table not_existing_database.test (a int);
--error 1103
create table `a/a` (a int);
@@ -294,7 +294,7 @@
create table t3 like t1;
--error 1050
create table t3 like mysqltest.t3;
---error 1044,1
+--error 1049
create table non_existing_database.t1 like t1;
--error 1051
create table t3 like non_existing_table;
| Thread |
|---|
| • bk commit into 4.1 tree (jimw:1.2333) BUG#10407 | Jim Winstead | 22 Jul |