diff options
author | Sergey Vojtovich <svoj@sun.com> | 2010-03-03 14:49:03 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@sun.com> | 2010-03-03 14:49:03 +0400 |
commit | 1d2aeb3da2dedc81a294629b50a6f47a3b377949 (patch) | |
tree | 609707a35cf570ea3211ac4d61542b99c149670d /mysql-test/t/merge.test | |
parent | 6124451d9534b1a03e58724411c492d9de980cb4 (diff) | |
download | mariadb-git-1d2aeb3da2dedc81a294629b50a6f47a3b377949.tar.gz |
BUG#48265 - MRG_MYISAM problem (works in 5.0.85, does't
work in 5.1.40)
MERGE engine fails to open child table from a different
database if child table/database name contains characters
that are subject for table name to filename encoding
(WL1324).
Another problem is that MERGE engine didn't properly open
child table from the same database if child table name
contains characters like '/', '#'.
The problem was that table name to file name encoding was
applied inconsistently:
* On CREATE: encode table name + database name if child
table is in different database; do not encode table
name if child table is in the same database;
* No decoding on open.
With this fix child table/database names are always
encoded on CREATE and decoded on open. Compatibility
with older tables preserved.
Along with this patch comes fix for SHOW CREATE TABLE,
which used to show child table/database path instead
of child table/database names.
mysql-test/r/merge.result:
A test case for BUG#48265.
mysql-test/std_data/bug48265.frm:
MERGE table from 5.0 to test fix for BUG#48265 compatibility.
mysql-test/t/merge.test:
A test case for BUG#48265.
storage/myisammrg/ha_myisammrg.cc:
On CREATE always write child table/database name encoded
by table name to filename encoding to dot-MRG file.
On open decode child table/database name.
Compatibilty with previous versions preserved.
Fixed ::append_create_info() to return child
table/database name instead of path.
storage/myisammrg/myrg_open.c:
Move if (has_path) branch from myrg_parent_open() to
myisammrg_parent_open_callback. The callback function
needs to know if child table was written along with
database name to dot-MRG file. Needed for compatibility
reasons.
Diffstat (limited to 'mysql-test/t/merge.test')
-rw-r--r-- | mysql-test/t/merge.test | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 015ae28c155..d88467cc7a9 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -7,6 +7,8 @@ drop table if exists t1,t2,t3,t4,t5,t6; drop database if exists mysqltest; --enable_warnings +let $MYSQLD_DATADIR= `select @@datadir`; + create table t1 (a int not null primary key auto_increment, message char(20)); create table t2 (a int not null primary key auto_increment, message char(20)); INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1"); @@ -1633,4 +1635,59 @@ SHOW CREATE TRIGGER tr1; DROP TRIGGER tr1; DROP TABLE t1, t2, t3; +--echo # +--echo # BUG#48265 - MRG_MYISAM problem (works in 5.0.85, does't work in 5.1.40) +--echo # +CREATE DATABASE `test/1`; + +CREATE TABLE `test/1`.`t/1`(a INT); +CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`); +SELECT * FROM m1; +SHOW CREATE TABLE m1; +DROP TABLE m1; + +CREATE TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`); +SELECT * FROM `test/1`.m1; +SHOW CREATE TABLE `test/1`.m1; +DROP TABLE `test/1`.m1; +DROP TABLE `test/1`.`t/1`; + +CREATE TEMPORARY TABLE `test/1`.`t/1`(a INT); +CREATE TEMPORARY TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`); +SELECT * FROM m1; +SHOW CREATE TABLE m1; +DROP TABLE m1; + +CREATE TEMPORARY TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`); +SELECT * FROM `test/1`.m1; +SHOW CREATE TABLE `test/1`.m1; +DROP TABLE `test/1`.m1; +DROP TABLE `test/1`.`t/1`; + +DROP DATABASE `test/1`; + +# Test compatibility. Use '@' instead of '/' (was not allowed in 5.0) + +CREATE TABLE `t@1`(a INT); +copy_file std_data/bug48265.frm $MYSQLD_DATADIR/test/m1.frm; +write_file $MYSQLD_DATADIR/test/m1.MRG; +t@1 +EOF +SELECT * FROM m1; +SHOW CREATE TABLE m1; +DROP TABLE `t@1`; + +CREATE DATABASE `test@1`; +CREATE TABLE `test@1`.`t@1`(a INT); +FLUSH TABLE m1; +remove_file $MYSQLD_DATADIR/test/m1.MRG; +write_file $MYSQLD_DATADIR/test/m1.MRG; +./test@1/t@1 +EOF +SELECT * FROM m1; +SHOW CREATE TABLE m1; +DROP TABLE m1; +DROP TABLE `test@1`.`t@1`; +DROP DATABASE `test@1`; + --echo End of 5.1 tests |