Commit 3994b215 authored by holyfoot@deer.(none)'s avatar holyfoot@deer.(none)

Fix for bug #15225 (ANALYZE temporary has no effect)

parent dd7d2d0a
...@@ -37,3 +37,12 @@ Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_ ...@@ -37,3 +37,12 @@ Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_
execute stmt1; execute stmt1;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
deallocate prepare stmt1; deallocate prepare stmt1;
create temporary table t1(a int, index(a));
insert into t1 values('1'),('2'),('3'),('4'),('5');
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A 5 NULL NULL YES BTREE
drop table t1;
...@@ -48,4 +48,13 @@ execute stmt1; ...@@ -48,4 +48,13 @@ execute stmt1;
execute stmt1; execute stmt1;
deallocate prepare stmt1; deallocate prepare stmt1;
#
# bug#15225 (ANALYZE temporary has no effect)
#
create temporary table t1(a int, index(a));
insert into t1 values('1'),('2'),('3'),('4'),('5');
analyze table t1;
show index from t1;
drop table t1;
# End of 4.1 tests # End of 4.1 tests
...@@ -2140,10 +2140,15 @@ send_result_message: ...@@ -2140,10 +2140,15 @@ send_result_message:
table->table->version=0; // Force close of table table->table->version=0; // Force close of table
else if (open_for_modify) else if (open_for_modify)
{ {
pthread_mutex_lock(&LOCK_open); if (table->table->tmp_table)
remove_table_from_cache(thd, table->table->table_cache_key, table->table->file->info(HA_STATUS_CONST);
table->table->real_name, RTFC_NO_FLAG); else
pthread_mutex_unlock(&LOCK_open); {
pthread_mutex_lock(&LOCK_open);
remove_table_from_cache(thd, table->table->table_cache_key,
table->table->real_name, RTFC_NO_FLAG);
pthread_mutex_unlock(&LOCK_open);
}
/* May be something modified consequently we have to invalidate cache */ /* May be something modified consequently we have to invalidate cache */
query_cache_invalidate3(thd, table->table, 0); query_cache_invalidate3(thd, table->table, 0);
} }
......
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