From 31b6e47d020c19f26083ba8d48c036936cd4e582 Mon Sep 17 00:00:00 2001 From: unknown <tomas@whalegate.ndb.mysql.com> Date: Tue, 9 Oct 2007 09:39:39 +0200 Subject: [PATCH] Bug #31470 ndb table with special characters in name are not discovered correctly --- mysql-test/suite/ndb/r/ndb_multi.result | 21 +++++++++++++++++++ mysql-test/suite/ndb/t/ndb_multi.test | 27 +++++++++++++++++++++++++ sql/handler.cc | 3 +-- 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/ndb/r/ndb_multi.result b/mysql-test/suite/ndb/r/ndb_multi.result index 2bc49bf9b45..98c4265b833 100644 --- a/mysql-test/suite/ndb/r/ndb_multi.result +++ b/mysql-test/suite/ndb/r/ndb_multi.result @@ -121,3 +121,24 @@ show tables; Tables_in_db t2 drop database db; +use test; +create table `test`.`t1$EX` + (server_id int unsigned, +master_server_id int unsigned, +master_epoch bigint unsigned, +count int unsigned, +primary key(server_id, master_server_id, +master_epoch, count)) +engine ndb; +show tables like '%$%'; +Tables_in_test (%$%) +t1$EX +use test; +show tables like '%$%'; +Tables_in_test (%$%) +t1$EX +drop table `test`.`t1$EX`; +show tables like '%$%'; +Tables_in_test (%$%) +show tables like '%$%'; +Tables_in_test (%$%) diff --git a/mysql-test/suite/ndb/t/ndb_multi.test b/mysql-test/suite/ndb/t/ndb_multi.test index b8e052d606b..ce7e22b3b7f 100644 --- a/mysql-test/suite/ndb/t/ndb_multi.test +++ b/mysql-test/suite/ndb/t/ndb_multi.test @@ -122,4 +122,31 @@ connection server2; show tables; drop database db; + +# +# bug#31470, ndb table with special characters in name +# are not discovered correctly +connection server1; +use test; +create table `test`.`t1$EX` + (server_id int unsigned, + master_server_id int unsigned, + master_epoch bigint unsigned, + count int unsigned, + primary key(server_id, master_server_id, + master_epoch, count)) + engine ndb; + +# check that table shows up ok on both servers +# before bugfix table would not show up on server2 +show tables like '%$%'; +connection server2; +use test; +show tables like '%$%'; + +# check cleanup +drop table `test`.`t1$EX`; +show tables like '%$%'; + connection server1; +show tables like '%$%'; diff --git a/sql/handler.cc b/sql/handler.cc index dbe7f6727f7..126882c8e44 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2641,8 +2641,7 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name) frmblob and frmlen are set, write the frm to disk */ - (void)strxnmov(path,FN_REFLEN-1,mysql_data_home,FN_ROOTDIR, - db,FN_ROOTDIR,name,NullS); + build_table_filename(path, FN_REFLEN-1, db, name, "", 0); // Save the frm file error= writefrm(path, frmblob, frmlen); my_free(frmblob, MYF(0)); -- 2.30.9