From: Date: May 9 2005 9:25am Subject: bk commit into 4.1 tree (jimw:1.2244) BUG#10407 List-Archive: http://lists.mysql.com/internals/24706 X-Bug: 10407 Message-Id: <20050509072533.EEF83A85F8@rama.trainedmonkey.com> 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.2244 05/05/09 00:25:29 jimw@stripped +3 -0 Fix error message generated when trying to create a table in a non-existent database. (Bug #10407) sql/sql_table.cc 1.280 05/05/09 00:02:07 jimw@stripped +11 -1 Verify that a database exists before trying to create a table in it mysql-test/r/create.result 1.78 05/05/09 00:01:51 jimw@stripped +1 -1 Update result mysql-test/t/create.test 1.50 05/05/09 00:00:51 jimw@stripped +2 -1 Update error generated by 'CREATE TABLE not_existing_database.test' # 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.279/sql/sql_table.cc 2005-04-28 15:30:40 -07:00 +++ 1.280/sql/sql_table.cc 2005-05-09 00:02:07 -07:00 @@ -1245,7 +1245,7 @@ { char path[FN_REFLEN]; const char *alias; - int error= -1; + int length, error= -1; uint db_options, key_count; KEY *key_info_buffer; handler *file; @@ -1289,6 +1289,16 @@ DBUG_RETURN(-1); } #endif + + (void) sprintf(path,"%s/%s",mysql_data_home,db); + length=unpack_dirname(path,path); // Convert if not unix + if (length && path[length-1] == FN_LIBCHAR) + path[length-1]=0; // remove ending '\' + if (access(path,F_OK)) + { + my_error(ER_BAD_DB_ERROR,MYF(0),db); + DBUG_RETURN(-1); + } /* If the table character set was not given explicitely, --- 1.77/mysql-test/r/create.result 2005-05-07 06:46:50 -07:00 +++ 1.78/mysql-test/r/create.result 2005-05-09 00:01:51 -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); --- 1.49/mysql-test/t/create.test 2005-05-07 05:50:20 -07:00 +++ 1.50/mysql-test/t/create.test 2005-05-09 00:00:51 -07:00 @@ -39,7 +39,8 @@ --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 +# Bug #10407: Display correct error when db does not exist +-- error 1049 create table not_existing_database.test (a int); --error 1103 create table `a/a` (a int);