Commit 8ef6ae74 authored by jimw@mysql.com's avatar jimw@mysql.com

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)
parent 6f95cf02
......@@ -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
......@@ -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;
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment