summaryrefslogtreecommitdiff
path: root/mysql-test/r/merge.result
diff options
context:
space:
mode:
authorunknown <svoj@mysql.com/june.mysql.com>2008-03-14 19:38:22 +0400
committerunknown <svoj@mysql.com/june.mysql.com>2008-03-14 19:38:22 +0400
commit196b616accbc73d212f21e2ec84353931a2f286b (patch)
treedaf13becfa89ba481b4a9543f23a500ae9708045 /mysql-test/r/merge.result
parent1e8b11c6565516f53375cbeed1641157f1d1981b (diff)
downloadmariadb-git-196b616accbc73d212f21e2ec84353931a2f286b.tar.gz
BUG#28248 - mysqldump results with MERGE ... UNION=() cannot be executed
When there are no underlying tables specified for a merge table, SHOW CREATE TABLE outputs a statement that cannot be executed. The same is true for mysqldump (it generates dumps that cannot be executed). This happens because SQL parser does not accept empty UNION() clause. This patch changes the following: - it is now possible to execute CREATE/ALTER statement with empty UNION() clause. - the same as above, but still worth noting: it is now possible to remove underlying tables mapping using ALTER TABLE ... UNION=(). - SHOW CREATE TABLE does not output UNION() clause if there are no underlying tables specified for a merge table. This makes mysqldump slightly smaller. mysql-test/r/merge.result: A test case for BUG#28248. mysql-test/t/merge.test: A test case for BUG#28248. sql/ha_myisammrg.cc: Do not output UNION clause in SHOW CREATE TABLE, when there are no underlying tables defined. sql/sql_yacc.yy: Make underlying table list for MERGE engine optional. As for MERGE engine empty underlying tables list is valid, it should be valid for the parser as well. This change is mostly needed to restore dumps made by earlier MySQL versions. Also with this fix it is possible to remove underlying tables mapping by using ALTER TABLE ... UNION=().
Diffstat (limited to 'mysql-test/r/merge.result')
-rw-r--r--mysql-test/r/merge.result22
1 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index 2ceae95dfca..f8ef4f23180 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -918,4 +918,26 @@ id ref
3 2
4 5
DROP TABLE t1, t2, t3;
+CREATE TABLE t1(a INT);
+CREATE TABLE m1(a INT) ENGINE=MERGE;
+SHOW CREATE TABLE m1;
+Table Create Table
+m1 CREATE TABLE `m1` (
+ `a` int(11) default NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
+DROP TABLE m1;
+CREATE TABLE m1(a INT) ENGINE=MERGE UNION=();
+SHOW CREATE TABLE m1;
+Table Create Table
+m1 CREATE TABLE `m1` (
+ `a` int(11) default NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE m1 UNION=(t1);
+ALTER TABLE m1 UNION=();
+SHOW CREATE TABLE m1;
+Table Create Table
+m1 CREATE TABLE `m1` (
+ `a` int(11) default NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1, m1;
End of 5.0 tests