Loading .bzrignore +1 −0 Original line number Diff line number Diff line Loading @@ -545,3 +545,4 @@ vio/test-sslserver vio/viotest-ssl scripts/make_win_binary_distribution EXCEPTIONS-CLIENT support-files/my-innodb-heavy-4G.cnf myisammrg/myrg_open.c +14 −14 Original line number Diff line number Diff line Loading @@ -34,14 +34,17 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) { int save_errno,errpos=0; uint files=0,i,dir_length,length,key_parts; ulonglong file_offset; ulonglong file_offset=0; char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end; MYRG_INFO *m_info=0; File fd; IO_CACHE file; MI_INFO *isam=0; uint found_merge_insert_method= 0; DBUG_ENTER("myrg_open"); LINT_INIT(key_parts); bzero((char*) &file,sizeof(file)); if ((fd=my_open(fn_format(name_buff,name,"",MYRG_NAME_EXT,4), O_RDONLY | O_SHARE,MYF(0))) < 0) Loading Loading @@ -72,7 +75,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) if (!strncmp(buff+1,"INSERT_METHOD=",14)) { /* Lookup insert method */ int tmp=find_type(buff+15,&merge_insert_method,2); m_info->merge_insert_method = (uint) (tmp >= 0 ? tmp : 0); found_merge_insert_method = (uint) (tmp >= 0 ? tmp : 0); } continue; /* Skip comments */ } Loading @@ -85,7 +88,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) } if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0)))) goto err; if (!m_info) if (!m_info) /* First file */ { key_parts=isam->s->base.key_parts; if (!(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO) + Loading @@ -97,15 +100,10 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) { m_info->open_tables=(MYRG_TABLE *) (m_info+1); m_info->rec_per_key_part=(ulong *) (m_info->open_tables+files); } else { m_info->open_tables=0; m_info->rec_per_key_part=0; } m_info->tables= files; files= 0; } m_info->reclength=isam->s->base.reclength; file_offset=files=0; errpos=3; } m_info->open_tables[files].table= isam; Loading @@ -122,7 +120,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) m_info->del+= isam->state->del; m_info->data_file_length+= isam->state->data_file_length; for (i=0; i < key_parts; i++) m_info->rec_per_key_part[i]+=isam->s->state.rec_per_key_part[i] / m_info->tables; m_info->rec_per_key_part[i]+= (isam->s->state.rec_per_key_part[i] / m_info->tables); } if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO), Loading @@ -130,6 +129,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) goto err; /* Don't mark table readonly, for ALTER TABLE ... UNION=(...) to work */ m_info->options&= ~(HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA); m_info->merge_insert_method= found_merge_insert_method; if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L) { Loading mysql-test/r/union.result +8 −1 Original line number Diff line number Diff line Loading @@ -88,7 +88,6 @@ explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a l table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 4 t2 ALL NULL NULL NULL NULL 4 Using filesort t1 ALL NULL NULL NULL NULL 4 (select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2; a b 1 a Loading Loading @@ -420,6 +419,7 @@ a (SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1; Wrong usage/placement of 'SQL_CALC_FOUND_ROWS' create temporary table t1 select a from t1 union select a from t2; drop table t1; create table t1 select a from t1 union select a from t2; INSERT TABLE 't1' isn't allowed in FROM table list select a from t1 union select a from t2 order by t2.a; Loading @@ -429,3 +429,10 @@ select length(version()) > 1 as `*` UNION select 2; * 1 2 create table t1 (a int); insert into t1 values (0), (3), (1), (2); explain (select * from t1) union (select * from t1) order by a; table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 4 t1 ALL NULL NULL NULL NULL 4 drop table t1; mysql-test/t/union.test +9 −0 Original line number Diff line number Diff line Loading @@ -224,6 +224,7 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1; (SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1; create temporary table t1 select a from t1 union select a from t2; drop table t1; --error 1093 create table t1 select a from t1 union select a from t2; --error 1054 Loading @@ -236,3 +237,11 @@ drop table t1,t2; select length(version()) > 1 as `*` UNION select 2; # # Bug #4980: problem with explain # create table t1 (a int); insert into t1 values (0), (3), (1), (2); explain (select * from t1) union (select * from t1) order by a; drop table t1; sql/Makefile.am +1 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ gen_lex_hash.o: gen_lex_hash.cc lex.h sql_yacc.cc: sql_yacc.yy sql_yacc.h: sql_yacc.yy sql_yacc.o: sql_yacc.cc sql_yacc.h sql_yacc.o: sql_yacc.cc sql_yacc.h $(noinst_HEADERS) @echo "Note: The following compile may take a long time." @echo "If it fails, re-run configure with --with-low-memory" $(CXXCOMPILE) $(LM_CFLAGS) -c $< Loading Loading
.bzrignore +1 −0 Original line number Diff line number Diff line Loading @@ -545,3 +545,4 @@ vio/test-sslserver vio/viotest-ssl scripts/make_win_binary_distribution EXCEPTIONS-CLIENT support-files/my-innodb-heavy-4G.cnf
myisammrg/myrg_open.c +14 −14 Original line number Diff line number Diff line Loading @@ -34,14 +34,17 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) { int save_errno,errpos=0; uint files=0,i,dir_length,length,key_parts; ulonglong file_offset; ulonglong file_offset=0; char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end; MYRG_INFO *m_info=0; File fd; IO_CACHE file; MI_INFO *isam=0; uint found_merge_insert_method= 0; DBUG_ENTER("myrg_open"); LINT_INIT(key_parts); bzero((char*) &file,sizeof(file)); if ((fd=my_open(fn_format(name_buff,name,"",MYRG_NAME_EXT,4), O_RDONLY | O_SHARE,MYF(0))) < 0) Loading Loading @@ -72,7 +75,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) if (!strncmp(buff+1,"INSERT_METHOD=",14)) { /* Lookup insert method */ int tmp=find_type(buff+15,&merge_insert_method,2); m_info->merge_insert_method = (uint) (tmp >= 0 ? tmp : 0); found_merge_insert_method = (uint) (tmp >= 0 ? tmp : 0); } continue; /* Skip comments */ } Loading @@ -85,7 +88,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) } if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0)))) goto err; if (!m_info) if (!m_info) /* First file */ { key_parts=isam->s->base.key_parts; if (!(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO) + Loading @@ -97,15 +100,10 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) { m_info->open_tables=(MYRG_TABLE *) (m_info+1); m_info->rec_per_key_part=(ulong *) (m_info->open_tables+files); } else { m_info->open_tables=0; m_info->rec_per_key_part=0; } m_info->tables= files; files= 0; } m_info->reclength=isam->s->base.reclength; file_offset=files=0; errpos=3; } m_info->open_tables[files].table= isam; Loading @@ -122,7 +120,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) m_info->del+= isam->state->del; m_info->data_file_length+= isam->state->data_file_length; for (i=0; i < key_parts; i++) m_info->rec_per_key_part[i]+=isam->s->state.rec_per_key_part[i] / m_info->tables; m_info->rec_per_key_part[i]+= (isam->s->state.rec_per_key_part[i] / m_info->tables); } if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO), Loading @@ -130,6 +129,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) goto err; /* Don't mark table readonly, for ALTER TABLE ... UNION=(...) to work */ m_info->options&= ~(HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA); m_info->merge_insert_method= found_merge_insert_method; if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L) { Loading
mysql-test/r/union.result +8 −1 Original line number Diff line number Diff line Loading @@ -88,7 +88,6 @@ explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a l table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 4 t2 ALL NULL NULL NULL NULL 4 Using filesort t1 ALL NULL NULL NULL NULL 4 (select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2; a b 1 a Loading Loading @@ -420,6 +419,7 @@ a (SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1; Wrong usage/placement of 'SQL_CALC_FOUND_ROWS' create temporary table t1 select a from t1 union select a from t2; drop table t1; create table t1 select a from t1 union select a from t2; INSERT TABLE 't1' isn't allowed in FROM table list select a from t1 union select a from t2 order by t2.a; Loading @@ -429,3 +429,10 @@ select length(version()) > 1 as `*` UNION select 2; * 1 2 create table t1 (a int); insert into t1 values (0), (3), (1), (2); explain (select * from t1) union (select * from t1) order by a; table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 4 t1 ALL NULL NULL NULL NULL 4 drop table t1;
mysql-test/t/union.test +9 −0 Original line number Diff line number Diff line Loading @@ -224,6 +224,7 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1; (SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1; create temporary table t1 select a from t1 union select a from t2; drop table t1; --error 1093 create table t1 select a from t1 union select a from t2; --error 1054 Loading @@ -236,3 +237,11 @@ drop table t1,t2; select length(version()) > 1 as `*` UNION select 2; # # Bug #4980: problem with explain # create table t1 (a int); insert into t1 values (0), (3), (1), (2); explain (select * from t1) union (select * from t1) order by a; drop table t1;
sql/Makefile.am +1 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ gen_lex_hash.o: gen_lex_hash.cc lex.h sql_yacc.cc: sql_yacc.yy sql_yacc.h: sql_yacc.yy sql_yacc.o: sql_yacc.cc sql_yacc.h sql_yacc.o: sql_yacc.cc sql_yacc.h $(noinst_HEADERS) @echo "Note: The following compile may take a long time." @echo "If it fails, re-run configure with --with-low-memory" $(CXXCOMPILE) $(LM_CFLAGS) -c $< Loading