Commit 9ec97f2c authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

fixed table invalidation in simple renaming

parent caaff55c
...@@ -542,3 +542,14 @@ select * from mysql.db; ...@@ -542,3 +542,14 @@ select * from mysql.db;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 0 Qcache_queries_in_cache 0
create table t1(id int auto_increment primary key);
insert into t1 values (NULL), (NULL), (NULL);
select * from t1 where id=2;
id
2
alter table t1 rename to t2;
select * from t1 where id=2;
Table 'test.t1' doesn't exist
drop table t2;
select * from t1 where id=2;
Table 'test.t1' doesn't exist
...@@ -383,3 +383,17 @@ disable_result_log; ...@@ -383,3 +383,17 @@ disable_result_log;
select * from mysql.db; select * from mysql.db;
enable_result_log; enable_result_log;
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
#
# simple rename test
#
create table t1(id int auto_increment primary key);
insert into t1 values (NULL), (NULL), (NULL);
select * from t1 where id=2;
alter table t1 rename to t2;
-- error 1146
select * from t1 where id=2;
drop table t2;
-- error 1146
select * from t1 where id=2;
...@@ -1432,6 +1432,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -1432,6 +1432,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
} }
send_ok(&thd->net); send_ok(&thd->net);
} }
table_list->table=0; // For query cache
query_cache_invalidate3(thd, table_list, 0);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment