Loading myisam/mi_create.c +15 −0 Original line number Diff line number Diff line Loading @@ -533,6 +533,21 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, create_flag=MY_DELETE_OLD; } /* If a MRG_MyISAM table is in use, the mapped MyISAM tables are open, but no entry is made in the table cache for them. A TRUNCATE command checks for the table in the cache only and could be fooled to believe, the table is not open. Pull the emergency brake in this situation. (Bug #8306) */ if (test_if_reopen(filename)) { my_printf_error(0, "MyISAM table '%s' is in use " "(most likely by a MERGE table). Try FLUSH TABLES.", MYF(0), name + dirname_length(name)); goto err; } if ((file= my_create_with_symlink(linkname_ptr, filename, 0, O_RDWR | O_TRUNC, Loading myisam/mi_open.c +1 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ if (pos > end_pos) \ ** In MySQL the server will handle version issues. ******************************************************************************/ static MI_INFO *test_if_reopen(char *filename) MI_INFO *test_if_reopen(char *filename) { LIST *pos; Loading myisam/myisamdef.h +1 −0 Original line number Diff line number Diff line Loading @@ -705,6 +705,7 @@ void mi_copy_status(void* to,void *from); my_bool mi_check_status(void* param); void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows); extern MI_INFO *test_if_reopen(char *filename); my_bool check_table_is_closed(const char *name, const char *where); int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup); int mi_open_keyfile(MYISAM_SHARE *share); Loading mysql-test/r/bigint.result +39 −0 Original line number Diff line number Diff line Loading @@ -87,3 +87,42 @@ drop table t1; SELECT '0x8000000000000001'+0; '0x8000000000000001'+0 0 create table t1 ( value64 bigint unsigned not null, value32 integer not null, primary key(value64, value32) ); create table t2 ( value64 bigint unsigned not null, value32 integer not null, primary key(value64, value32) ); insert into t1 values(17156792991891826145, 1); insert into t1 values( 9223372036854775807, 2); insert into t2 values(17156792991891826145, 3); insert into t2 values( 9223372036854775807, 4); select * from t1; value64 value32 9223372036854775807 2 17156792991891826145 1 select * from t2; value64 value32 9223372036854775807 4 17156792991891826145 3 select * from t1, t2 where t1.value64=17156792991891826145 and t2.value64=17156792991891826145; value64 value32 value64 value32 17156792991891826145 1 17156792991891826145 3 select * from t1, t2 where t1.value64=17156792991891826145 and t2.value64=t1.value64; value64 value32 value64 value32 17156792991891826145 1 17156792991891826145 3 select * from t1, t2 where t1.value64= 9223372036854775807 and t2.value64=9223372036854775807; value64 value32 value64 value32 9223372036854775807 2 9223372036854775807 4 select * from t1, t2 where t1.value64= 9223372036854775807 and t2.value64=t1.value64; value64 value32 value64 value32 9223372036854775807 2 9223372036854775807 4 drop table t1, t2; mysql-test/r/myisam.result +18 −0 Original line number Diff line number Diff line Loading @@ -555,3 +555,21 @@ select count(*) from t1 where a is null; count(*) 2 drop table t1; create table t1 (c1 int, index(c1)); create table t2 (c1 int, index(c1)) engine=merge union=(t1); insert into t1 values (1); flush tables; select * from t2; c1 1 flush tables; truncate table t1; insert into t1 values (1); flush tables; select * from t2; c1 1 truncate table t1; ERROR HY000: MyISAM table 't1' is in use (most likely by a MERGE table). Try FLUSH TABLES. insert into t1 values (1); drop table t1,t2; Loading
myisam/mi_create.c +15 −0 Original line number Diff line number Diff line Loading @@ -533,6 +533,21 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, create_flag=MY_DELETE_OLD; } /* If a MRG_MyISAM table is in use, the mapped MyISAM tables are open, but no entry is made in the table cache for them. A TRUNCATE command checks for the table in the cache only and could be fooled to believe, the table is not open. Pull the emergency brake in this situation. (Bug #8306) */ if (test_if_reopen(filename)) { my_printf_error(0, "MyISAM table '%s' is in use " "(most likely by a MERGE table). Try FLUSH TABLES.", MYF(0), name + dirname_length(name)); goto err; } if ((file= my_create_with_symlink(linkname_ptr, filename, 0, O_RDWR | O_TRUNC, Loading
myisam/mi_open.c +1 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ if (pos > end_pos) \ ** In MySQL the server will handle version issues. ******************************************************************************/ static MI_INFO *test_if_reopen(char *filename) MI_INFO *test_if_reopen(char *filename) { LIST *pos; Loading
myisam/myisamdef.h +1 −0 Original line number Diff line number Diff line Loading @@ -705,6 +705,7 @@ void mi_copy_status(void* to,void *from); my_bool mi_check_status(void* param); void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows); extern MI_INFO *test_if_reopen(char *filename); my_bool check_table_is_closed(const char *name, const char *where); int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup); int mi_open_keyfile(MYISAM_SHARE *share); Loading
mysql-test/r/bigint.result +39 −0 Original line number Diff line number Diff line Loading @@ -87,3 +87,42 @@ drop table t1; SELECT '0x8000000000000001'+0; '0x8000000000000001'+0 0 create table t1 ( value64 bigint unsigned not null, value32 integer not null, primary key(value64, value32) ); create table t2 ( value64 bigint unsigned not null, value32 integer not null, primary key(value64, value32) ); insert into t1 values(17156792991891826145, 1); insert into t1 values( 9223372036854775807, 2); insert into t2 values(17156792991891826145, 3); insert into t2 values( 9223372036854775807, 4); select * from t1; value64 value32 9223372036854775807 2 17156792991891826145 1 select * from t2; value64 value32 9223372036854775807 4 17156792991891826145 3 select * from t1, t2 where t1.value64=17156792991891826145 and t2.value64=17156792991891826145; value64 value32 value64 value32 17156792991891826145 1 17156792991891826145 3 select * from t1, t2 where t1.value64=17156792991891826145 and t2.value64=t1.value64; value64 value32 value64 value32 17156792991891826145 1 17156792991891826145 3 select * from t1, t2 where t1.value64= 9223372036854775807 and t2.value64=9223372036854775807; value64 value32 value64 value32 9223372036854775807 2 9223372036854775807 4 select * from t1, t2 where t1.value64= 9223372036854775807 and t2.value64=t1.value64; value64 value32 value64 value32 9223372036854775807 2 9223372036854775807 4 drop table t1, t2;
mysql-test/r/myisam.result +18 −0 Original line number Diff line number Diff line Loading @@ -555,3 +555,21 @@ select count(*) from t1 where a is null; count(*) 2 drop table t1; create table t1 (c1 int, index(c1)); create table t2 (c1 int, index(c1)) engine=merge union=(t1); insert into t1 values (1); flush tables; select * from t2; c1 1 flush tables; truncate table t1; insert into t1 values (1); flush tables; select * from t2; c1 1 truncate table t1; ERROR HY000: MyISAM table 't1' is in use (most likely by a MERGE table). Try FLUSH TABLES. insert into t1 values (1); drop table t1,t2;