diff options
author | unknown <jimw@mysql.com> | 2005-04-28 15:30:42 -0700 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-04-28 15:30:42 -0700 |
commit | f54194e24005c16c7c075706663195305495b9f8 (patch) | |
tree | 0d3f86c29624a2336877bab198674022cff235ef | |
parent | d26b09fed4384cbd425682f66b00be8082397e9b (diff) | |
download | mariadb-git-f54194e24005c16c7c075706663195305495b9f8.tar.gz |
Fix 'CREATE TABLE ... LIKE ...' when lower_case_table_names
is set on case-sensitive file systems and the source table
was specified in something other than lowercase. (Bug #9761)
mysql-test/r/lowercase_table.result:
Add results
mysql-test/t/lowercase_table.test:
Regression test for Bug #9761
sql/sql_table.cc:
When lower_case_table_names is set, make sure to look for
the source table using a lowercase filename.
-rw-r--r-- | mysql-test/r/lowercase_table.result | 3 | ||||
-rw-r--r-- | mysql-test/t/lowercase_table.test | 8 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 |
3 files changed, 13 insertions, 0 deletions
diff --git a/mysql-test/r/lowercase_table.result b/mysql-test/r/lowercase_table.result index a30ec0f160c..ef379cebaa9 100644 --- a/mysql-test/r/lowercase_table.result +++ b/mysql-test/r/lowercase_table.result @@ -78,5 +78,8 @@ ERROR 42000: Not unique table/alias: 'C' select C.a, c.a from t1 c, t2 C; ERROR 42000: Not unique table/alias: 'C' drop table t1, t2; +create table t1 (a int); +create table t2 like T1; +drop table t1, t2; show tables; Tables_in_test diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test index a9c0c976afc..ee8dc403981 100644 --- a/mysql-test/t/lowercase_table.test +++ b/mysql-test/t/lowercase_table.test @@ -73,4 +73,12 @@ select * from t1 c, t2 C; select C.a, c.a from t1 c, t2 C; drop table t1, t2; +# +# Bug #9761: CREATE TABLE ... LIKE ... not handled correctly when +# lower_case_table_names is set + +create table t1 (a int); +create table t2 like T1; +drop table t1, t2; + show tables; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f3f8511026b..c03edfdb012 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2281,6 +2281,8 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table, reg_ext, NullS); /* Resolve symlinks (for windows) */ fn_format(src_path, src_path, "", "", MYF(MY_UNPACK_FILENAME)); + if (lower_case_table_names) + my_casedn_str(files_charset_info, src_path); if (access(src_path, F_OK)) { my_error(ER_BAD_TABLE_ERROR, MYF(0), src_table); |