Below is the list of changes that have just been committed into a local
5.0 repository of svoj. When svoj does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2008-03-14 19:38:22+04:00, svoj@stripped +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.
mysql-test/r/merge.result@stripped, 2008-03-14 19:38:20+04:00, svoj@stripped +22 -0
A test case for BUG#28248.
mysql-test/t/merge.test@stripped, 2008-03-14 19:38:20+04:00, svoj@stripped +13 -0
A test case for BUG#28248.
sql/ha_myisammrg.cc@stripped, 2008-03-14 19:38:20+04:00, svoj@stripped +6 -0
Do not output UNION clause in SHOW CREATE TABLE, when there are
no underlying tables defined.
sql/sql_yacc.yy@stripped, 2008-03-14 19:38:20+04:00, svoj@stripped +1 -1
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=().
diff -Nrup a/mysql-test/r/merge.result b/mysql-test/r/merge.result
--- a/mysql-test/r/merge.result 2007-11-26 20:35:04 +04:00
+++ b/mysql-test/r/merge.result 2008-03-14 19:38:20 +04:00
@@ -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
diff -Nrup a/mysql-test/t/merge.test b/mysql-test/t/merge.test
--- a/mysql-test/t/merge.test 2007-12-13 14:49:11 +04:00
+++ b/mysql-test/t/merge.test 2008-03-14 19:38:20 +04:00
@@ -542,5 +542,18 @@ SELECT * FROM t3;
DROP TABLE t1, t2, t3;
+#
+# BUG#28248 - mysqldump results with MERGE ... UNION=() cannot be executed
+#
+CREATE TABLE t1(a INT);
+CREATE TABLE m1(a INT) ENGINE=MERGE;
+SHOW CREATE TABLE m1;
+DROP TABLE m1;
+CREATE TABLE m1(a INT) ENGINE=MERGE UNION=();
+SHOW CREATE TABLE m1;
+ALTER TABLE m1 UNION=(t1);
+ALTER TABLE m1 UNION=();
+SHOW CREATE TABLE m1;
+DROP TABLE t1, m1;
--echo End of 5.0 tests
diff -Nrup a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc
--- a/sql/ha_myisammrg.cc 2007-11-26 19:58:51 +04:00
+++ b/sql/ha_myisammrg.cc 2008-03-14 19:38:20 +04:00
@@ -602,6 +602,12 @@ void ha_myisammrg::append_create_info(St
packet->append(STRING_WITH_LEN(" INSERT_METHOD="));
packet->append(get_type(&merge_insert_method,file->merge_insert_method-1));
}
+ /*
+ There is no sence adding UNION clause in case there is no underlying
+ tables specified.
+ */
+ if (file->open_tables == file->end_table)
+ return;
packet->append(STRING_WITH_LEN(" UNION=("));
MYRG_TABLE *open_table,*first;
diff -Nrup a/sql/sql_yacc.yy b/sql/sql_yacc.yy
--- a/sql/sql_yacc.yy 2008-02-28 18:34:06 +04:00
+++ b/sql/sql_yacc.yy 2008-03-14 19:38:20 +04:00
@@ -2932,7 +2932,7 @@ create_table_option:
my_error(ER_WARN_DEPRECATED_SYNTAX, MYF(0), "RAID_CHUNKSIZE", "PARTITION");
MYSQL_YYABORT;
}
- | UNION_SYM opt_equal '(' table_list ')'
+ | UNION_SYM opt_equal '(' opt_table_list ')'
{
/* Move the union list to the merge_list */
LEX *lex=Lex;
| Thread |
|---|
| • bk commit into 5.0 tree (svoj:1.2595) BUG#28248 | Sergey Vojtovich | 14 Mar |