Loading Docs/manual.texi +14 −8 Original line number Diff line number Diff line Loading @@ -37782,8 +37782,8 @@ The disadvantages with @code{MERGE} tables are: @itemize @bullet @item You can only use identical @code{MyISAM} tables for a @code{MERGE} table. @item @code{AUTO_INCREMENT} columns are not automatically updated on @code{INSERT}. @c @item @c @code{AUTO_INCREMENT} columns are not automatically updated on @code{INSERT}. @item @code{REPLACE} doesn't work. @item Loading Loading @@ -37823,13 +37823,13 @@ CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, message CHAR(20)); CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY, message CHAR(20)); INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1"); INSERT INTO t2 (message) VALUES ("Testing"),("table"),("t2"); CREATE TABLE total (a INT NOT NULL, message CHAR(20), KEY(a)) CREATE TABLE total (a INT AUTO_INCREMENT PRIMARY KEY, message CHAR(20)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST; @end example Note that we didn't create a @code{UNIQUE} or @code{PRIMARY KEY} in the @code{total} table as the key isn't going to be unique in the @code{total} table. @c Note that we didn't create a @code{UNIQUE} or @code{PRIMARY KEY} in the @c @code{total} table as the key isn't going to be unique in the @code{total} @c table. Note that you can also manipulate the @file{.MRG} file directly from the outside of the MySQL server: Loading @@ -37856,6 +37856,10 @@ mysql> SELECT * FROM total; +---+---------+ @end example Note that the @code{a} column, though declared as @code{PRIMARY KEY}, is not really unique, as @code{MERGE} table cannot enforce uniqueness over a set of underlying @code{MyISAM} tables. To remap a @code{MERGE} table you can do one of the following: @itemize @bullet Loading Loading @@ -37883,8 +37887,8 @@ The following are the known problems with @code{MERGE} tables: A @code{MERGE} table cannot maintain @code{UNIQUE} constraints over the whole table. When you do @code{INSERT}, the data goes into the first or last table (according to @code{INSERT_METHOD=xxx}) and this @code{MyISAM} table ensures that the data are unique, but it knows nothing about the first @code{MyISAM} table. table ensures that the data are unique, but it knows nothing about others @code{MyISAM} tables. @item @code{DELETE FROM merge_table} used without a @code{WHERE} will only clear the mapping for the table, not delete everything in the Loading Loading @@ -49694,6 +49698,8 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. @itemize @bullet @item Fixed a bug that made the pager option in the mysql client non-functional. @item Added full @code{AUTO_INCREMENT} support to @code{MERGE} tables. @end itemize @item Added OLAP functionality. include/my_sys.h +1 −2 Original line number Diff line number Diff line Loading @@ -323,8 +323,7 @@ typedef struct st_io_cache_share int count; /* actual IO_CACHE that filled the buffer */ struct st_io_cache *active; /* the following will be implemented whenever the need arises */ #ifdef NOT_IMPLEMENTED #ifdef NOT_YET_IMPLEMENTED /* whether the structure should be free'd */ my_bool alloced; #endif Loading include/myisam.h +1 −1 Original line number Diff line number Diff line Loading @@ -358,7 +358,7 @@ typedef struct st_sort_info MI_CHECK *param; enum data_file_type new_data_file_type; SORT_KEY_BLOCKS *key_block,*key_block_end; uint kei, total_keys; uint current_key, total_keys; my_off_t filelength,dupp,buff_length; ha_rows max_records; char *buff; Loading myisam/mi_check.c +2 −2 Original line number Diff line number Diff line Loading @@ -3223,7 +3223,7 @@ static int sort_delete_record(MI_SORT_PARAM *sort_param) old_file=info->dfile; info->dfile=info->rec_cache.file; if (sort_info->kei) if (sort_info->current_key) { key=info->lastkey+info->s->base.max_key_length; if ((error=(*info->s->read_rnd)(info,sort_param->record,info->lastpos,0)) && Loading @@ -3234,7 +3234,7 @@ static int sort_delete_record(MI_SORT_PARAM *sort_param) DBUG_RETURN(1); } for (i=0 ; i < sort_info->kei ; i++) for (i=0 ; i < sort_info->current_key ; i++) { uint key_length=_mi_make_key(info,i,key,sort_param->record,info->lastpos); if (_mi_ck_delete(info,i,key,key_length)) Loading mysql-test/r/merge.result +77 −10 Original line number Diff line number Diff line Loading @@ -275,12 +275,12 @@ a b 1 2 drop table t3,t1,t2; drop table if exists t6, t5, t4, t3, t2, t1; create table t1 (a int not null, b int not null, key(a,b)); create table t2 (a int not null, b int not null, key(a,b)); create table t1 (a int not null, b int not null auto_increment, primary key(a,b)); create table t2 (a int not null, b int not null auto_increment, primary key(a,b)); create table t3 (a int not null, b int not null, key(a,b)) UNION=(t1,t2) INSERT_METHOD=NO; create table t4 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=NO; create table t5 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST; create table t6 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST; create table t5 (a int not null, b int not null auto_increment, primary key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST; create table t6 (a int not null, b int not null auto_increment, primary key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST; show create table t3; Table Create Table t3 CREATE TABLE `t3` ( Loading @@ -299,18 +299,18 @@ show create table t5; Table Create Table t5 CREATE TABLE `t5` ( `a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', KEY `a` (`a`,`b`) `b` int(11) NOT NULL auto_increment, PRIMARY KEY (`a`,`b`) ) TYPE=MRG_MyISAM INSERT_METHOD=FIRST UNION=(t1,t2) show create table t6; Table Create Table t6 CREATE TABLE `t6` ( `a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', KEY `a` (`a`,`b`) `b` int(11) NOT NULL auto_increment, PRIMARY KEY (`a`,`b`) ) TYPE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1,t2) insert into t1 values (1,1),(1,2),(1,3),(1,4); insert into t2 values (2,1),(2,2),(2,3),(2,4); insert into t1 values (1,NULL),(1,NULL),(1,NULL),(1,NULL); insert into t2 values (2,NULL),(2,NULL),(2,NULL),(2,NULL); select * from t3 order by b,a limit 3; a b select * from t4 order by b,a limit 3; Loading Loading @@ -461,6 +461,73 @@ a b 5 2 6 1 6 2 select 1; 1 1 insert into t5 values (1,NULL),(5,NULL); insert into t6 values (2,NULL),(6,NULL); select * from t1 order by a,b; a b 1 1 1 2 1 3 1 4 1 5 4 1 4 2 5 1 5 2 5 3 select * from t2 order by a,b; a b 2 1 2 2 2 3 2 4 2 5 6 1 6 2 6 3 select * from t5 order by a,b; a b 1 1 1 2 1 3 1 4 1 5 2 1 2 2 2 3 2 4 2 5 4 1 4 2 5 1 5 2 5 3 6 1 6 2 6 3 select * from t6 order by a,b; a b 1 1 1 2 1 3 1 4 1 5 2 1 2 2 2 3 2 4 2 5 4 1 4 2 5 1 5 2 5 3 6 1 6 2 6 3 drop table if exists t6, t5, t4, t3, t2, t1; CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM; INSERT INTO t1 VALUES (1,1), (2,1); Loading Loading
Docs/manual.texi +14 −8 Original line number Diff line number Diff line Loading @@ -37782,8 +37782,8 @@ The disadvantages with @code{MERGE} tables are: @itemize @bullet @item You can only use identical @code{MyISAM} tables for a @code{MERGE} table. @item @code{AUTO_INCREMENT} columns are not automatically updated on @code{INSERT}. @c @item @c @code{AUTO_INCREMENT} columns are not automatically updated on @code{INSERT}. @item @code{REPLACE} doesn't work. @item Loading Loading @@ -37823,13 +37823,13 @@ CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, message CHAR(20)); CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY, message CHAR(20)); INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1"); INSERT INTO t2 (message) VALUES ("Testing"),("table"),("t2"); CREATE TABLE total (a INT NOT NULL, message CHAR(20), KEY(a)) CREATE TABLE total (a INT AUTO_INCREMENT PRIMARY KEY, message CHAR(20)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST; @end example Note that we didn't create a @code{UNIQUE} or @code{PRIMARY KEY} in the @code{total} table as the key isn't going to be unique in the @code{total} table. @c Note that we didn't create a @code{UNIQUE} or @code{PRIMARY KEY} in the @c @code{total} table as the key isn't going to be unique in the @code{total} @c table. Note that you can also manipulate the @file{.MRG} file directly from the outside of the MySQL server: Loading @@ -37856,6 +37856,10 @@ mysql> SELECT * FROM total; +---+---------+ @end example Note that the @code{a} column, though declared as @code{PRIMARY KEY}, is not really unique, as @code{MERGE} table cannot enforce uniqueness over a set of underlying @code{MyISAM} tables. To remap a @code{MERGE} table you can do one of the following: @itemize @bullet Loading Loading @@ -37883,8 +37887,8 @@ The following are the known problems with @code{MERGE} tables: A @code{MERGE} table cannot maintain @code{UNIQUE} constraints over the whole table. When you do @code{INSERT}, the data goes into the first or last table (according to @code{INSERT_METHOD=xxx}) and this @code{MyISAM} table ensures that the data are unique, but it knows nothing about the first @code{MyISAM} table. table ensures that the data are unique, but it knows nothing about others @code{MyISAM} tables. @item @code{DELETE FROM merge_table} used without a @code{WHERE} will only clear the mapping for the table, not delete everything in the Loading Loading @@ -49694,6 +49698,8 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. @itemize @bullet @item Fixed a bug that made the pager option in the mysql client non-functional. @item Added full @code{AUTO_INCREMENT} support to @code{MERGE} tables. @end itemize @item Added OLAP functionality.
include/my_sys.h +1 −2 Original line number Diff line number Diff line Loading @@ -323,8 +323,7 @@ typedef struct st_io_cache_share int count; /* actual IO_CACHE that filled the buffer */ struct st_io_cache *active; /* the following will be implemented whenever the need arises */ #ifdef NOT_IMPLEMENTED #ifdef NOT_YET_IMPLEMENTED /* whether the structure should be free'd */ my_bool alloced; #endif Loading
include/myisam.h +1 −1 Original line number Diff line number Diff line Loading @@ -358,7 +358,7 @@ typedef struct st_sort_info MI_CHECK *param; enum data_file_type new_data_file_type; SORT_KEY_BLOCKS *key_block,*key_block_end; uint kei, total_keys; uint current_key, total_keys; my_off_t filelength,dupp,buff_length; ha_rows max_records; char *buff; Loading
myisam/mi_check.c +2 −2 Original line number Diff line number Diff line Loading @@ -3223,7 +3223,7 @@ static int sort_delete_record(MI_SORT_PARAM *sort_param) old_file=info->dfile; info->dfile=info->rec_cache.file; if (sort_info->kei) if (sort_info->current_key) { key=info->lastkey+info->s->base.max_key_length; if ((error=(*info->s->read_rnd)(info,sort_param->record,info->lastpos,0)) && Loading @@ -3234,7 +3234,7 @@ static int sort_delete_record(MI_SORT_PARAM *sort_param) DBUG_RETURN(1); } for (i=0 ; i < sort_info->kei ; i++) for (i=0 ; i < sort_info->current_key ; i++) { uint key_length=_mi_make_key(info,i,key,sort_param->record,info->lastpos); if (_mi_ck_delete(info,i,key,key_length)) Loading
mysql-test/r/merge.result +77 −10 Original line number Diff line number Diff line Loading @@ -275,12 +275,12 @@ a b 1 2 drop table t3,t1,t2; drop table if exists t6, t5, t4, t3, t2, t1; create table t1 (a int not null, b int not null, key(a,b)); create table t2 (a int not null, b int not null, key(a,b)); create table t1 (a int not null, b int not null auto_increment, primary key(a,b)); create table t2 (a int not null, b int not null auto_increment, primary key(a,b)); create table t3 (a int not null, b int not null, key(a,b)) UNION=(t1,t2) INSERT_METHOD=NO; create table t4 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=NO; create table t5 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST; create table t6 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST; create table t5 (a int not null, b int not null auto_increment, primary key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST; create table t6 (a int not null, b int not null auto_increment, primary key(a,b)) TYPE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST; show create table t3; Table Create Table t3 CREATE TABLE `t3` ( Loading @@ -299,18 +299,18 @@ show create table t5; Table Create Table t5 CREATE TABLE `t5` ( `a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', KEY `a` (`a`,`b`) `b` int(11) NOT NULL auto_increment, PRIMARY KEY (`a`,`b`) ) TYPE=MRG_MyISAM INSERT_METHOD=FIRST UNION=(t1,t2) show create table t6; Table Create Table t6 CREATE TABLE `t6` ( `a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', KEY `a` (`a`,`b`) `b` int(11) NOT NULL auto_increment, PRIMARY KEY (`a`,`b`) ) TYPE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1,t2) insert into t1 values (1,1),(1,2),(1,3),(1,4); insert into t2 values (2,1),(2,2),(2,3),(2,4); insert into t1 values (1,NULL),(1,NULL),(1,NULL),(1,NULL); insert into t2 values (2,NULL),(2,NULL),(2,NULL),(2,NULL); select * from t3 order by b,a limit 3; a b select * from t4 order by b,a limit 3; Loading Loading @@ -461,6 +461,73 @@ a b 5 2 6 1 6 2 select 1; 1 1 insert into t5 values (1,NULL),(5,NULL); insert into t6 values (2,NULL),(6,NULL); select * from t1 order by a,b; a b 1 1 1 2 1 3 1 4 1 5 4 1 4 2 5 1 5 2 5 3 select * from t2 order by a,b; a b 2 1 2 2 2 3 2 4 2 5 6 1 6 2 6 3 select * from t5 order by a,b; a b 1 1 1 2 1 3 1 4 1 5 2 1 2 2 2 3 2 4 2 5 4 1 4 2 5 1 5 2 5 3 6 1 6 2 6 3 select * from t6 order by a,b; a b 1 1 1 2 1 3 1 4 1 5 2 1 2 2 2 3 2 4 2 5 4 1 4 2 5 1 5 2 5 3 6 1 6 2 6 3 drop table if exists t6, t5, t4, t3, t2, t1; CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM; INSERT INTO t1 VALUES (1,1), (2,1); Loading