mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user