diff options
author | unknown <svoj@june.mysql.com> | 2008-03-14 20:00:04 +0400 |
---|---|---|
committer | unknown <svoj@june.mysql.com> | 2008-03-14 20:00:04 +0400 |
commit | 3beb2d1a5d6bce175bbaed7556105ad406af88df (patch) | |
tree | 3c20e5e9cd7a7fbda89c653281c42ae9ca2d3850 | |
parent | 4afe31568b1b30d71d85b4ede412417c657d712f (diff) | |
parent | 7e01efff53ea45c053b4e99336271d661bab7754 (diff) | |
download | mariadb-git-3beb2d1a5d6bce175bbaed7556105ad406af88df.tar.gz |
Merge mysql.com:/home/svoj/devel/mysql/BUG28248/mysql-5.0-engines
into mysql.com:/home/svoj/devel/mysql/BUG28248/mysql-5.1-engines
mysql-test/r/merge.result:
Auto merged
mysql-test/t/merge.test:
Auto merged
storage/myisammrg/ha_myisammrg.cc:
Auto merged
sql/sql_yacc.yy:
After merge fix.
-rw-r--r-- | mysql-test/r/merge.result | 22 | ||||
-rw-r--r-- | mysql-test/t/merge.test | 13 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 2 | ||||
-rw-r--r-- | storage/myisammrg/ha_myisammrg.cc | 6 |
4 files changed, 42 insertions, 1 deletions
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index a709817b7ef..170cffc13d5 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -964,6 +964,28 @@ 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 create table t1 (c1 int, index(c1)); create table t2 (c1 int, index(c1)) engine=merge union=(t1); diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index e49297dd06c..a4602a3b82a 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -599,6 +599,19 @@ 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 --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 1bd90e74f47..c8d04bbcb7b 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4355,7 +4355,7 @@ create_table_option: Lex->create_info.row_type= $3; Lex->create_info.used_fields|= HA_CREATE_USED_ROW_FORMAT; } - | UNION_SYM opt_equal '(' table_list ')' + | UNION_SYM opt_equal '(' opt_table_list ')' { /* Move the union list to the merge_list */ LEX *lex=Lex; diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 3fccb91e9b5..7f305061b41 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -1102,6 +1102,12 @@ void ha_myisammrg::append_create_info(String *packet) 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=(")); current_db= table->s->db.str; |