Bug #28248 | mysqldump results with MERGE ... UNION=() cannot be executed | ||
---|---|---|---|
Submitted: | 4 May 2007 15:54 | Modified: | 30 Mar 2008 8:57 |
Reporter: | Tim Rosine | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Merge storage engine | Severity: | S3 (Non-critical) |
Version: | 5.0.42-BK, 5.0.27-log | OS: | Linux |
Assigned to: | Sergey Vojtovich | CPU Architecture: | Any |
[4 May 2007 15:54]
Tim Rosine
[4 May 2007 16:34]
Valeriy Kravchuk
Thank you for a bug report. Verified just as described with latest 5.0.42-BK on Linux. Simpler test case that demonstrates server(!) bug: openxs@suse:~/dbs/5.0> bin/mysql -uroot test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.0.42-debug Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create table template_merge (a int) engine=merge; Query OK, 0 rows affected (0.02 sec) mysql> show create table template_merge\G *************************** 1. row *************************** Table: template_merge Create Table: CREATE TABLE `template_merge` ( `a` int(11) default NULL ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=() 1 row in set (0.00 sec) mysql> create table tm2 -> `a` int(11) default NULL -> ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'a` in t(11) default NULL ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=()' at line 2
[9 Jan 2008 17:36]
Timothy Smith
Workaround: edit dump file to manually remove the empty UNION clause
[13 Mar 2008 16:05]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/43935 ChangeSet@1.2595, 2008-03-13 20:03:07+04:00, svoj@mysql.com +4 -0 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.
[14 Mar 2008 14:50]
Ingo Strüwing
Ok to push from me. One wish: Please add a test CREATE TABLE ... UNION=().
[14 Mar 2008 15:35]
Alexander Barkov
I agree with Ingo, otherwise http://lists.mysql.com/commits/43935 is OK to push.
[14 Mar 2008 15:41]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/44009 ChangeSet@1.2595, 2008-03-14 19:38:22+04:00, svoj@mysql.com +4 -0 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.
[14 Mar 2008 20:27]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/44044 ChangeSet@1.2560, 2008-03-15 00:24:10+04:00, svoj@mysql.com +2 -0 BUG#28248 - mysqldump results with MERGE ... UNION=() cannot be executed After merge fix.
[27 Mar 2008 11:21]
Bugs System
Pushed into 5.1.24-rc
[27 Mar 2008 11:21]
Bugs System
Pushed into 5.0.60
[27 Mar 2008 17:53]
Bugs System
Pushed into 6.0.5-alpha
[30 Mar 2008 8:57]
Jon Stephens
Documented bugfix in the 5.0.60, 5.1.23-ndb-6.3.11, 5.1.24, and 6.0.5 changelogs as follows: The SQL parser did not accept an empty UNION=() clause. This meant that, when there were no underlying tables specified for a MERGE table, SHOW CREATE TABLE and mysqldump both output statements that could not be executed. Now it is possible to execute a CREATE TABLE or ALTER TABLE statement with an empty UNION=() clause. However, SHOW CREATE TABLE and mysqldump do not output the UNION=() clause if there are no underlying tables specified for a merge table. This also means it is now possible to remove underlying tables from a MERGE table using ALTER TABLE ... UNION=().