summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2005-06-23 20:06:35 +0300
committerunknown <bell@sanja.is.com.ua>2005-06-23 20:06:35 +0300
commit0cc6dd83c469b105c6c4e9032d28b01dd208c532 (patch)
tree0d99be579b042cf0600548c9e9e8b0e29fc7ba11 /sql/sql_cache.cc
parent109323717470d3d7c2507b0e424a340eb05a0679 (diff)
downloadmariadb-git-0cc6dd83c469b105c6c4e9032d28b01dd208c532.tar.gz
temporary tables of subquery in the from clause just skipped during processing QC tables (BUG#11522)
mysql-test/r/query_cache.result: queries with subquery in the FROM clause mysql-test/t/query_cache.test: queries with subquery in the FROM clause sql/sql_cache.cc: temporary tables of subquery in the from clause just skipped during processing QC tables
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r--sql/sql_cache.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 8deb3489782..366a13d59ba 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -2114,6 +2114,13 @@ my_bool Query_cache::register_all_tables(Query_cache_block *block,
for (n=0; tables_used; tables_used=tables_used->next, n++, block_table++)
{
+ if (tables_used->derived)
+ {
+ DBUG_PRINT("qcache", ("derived table skipped"));
+ n--;
+ block_table--;
+ continue;
+ }
DBUG_PRINT("qcache",
("table %s, db %s, openinfo at 0x%lx, keylen %u, key at 0x%lx",
tables_used->real_name, tables_used->db,
@@ -2671,7 +2678,8 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len,
table_alias_charset used here because it depends of
lower_case_table_names variable
*/
- if (tables_used->table->tmp_table != NO_TMP_TABLE ||
+ if ((tables_used->table->tmp_table != NO_TMP_TABLE &&
+ !tables_used->derived) ||
(*tables_type & HA_CACHE_TBL_NOCACHE) ||
(tables_used->db_length == 5 &&
my_strnncoll(table_alias_charset, (uchar*)tables_used->db, 6,
@@ -2682,7 +2690,12 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len,
other non-cacheable table(s)"));
DBUG_RETURN(0);
}
- if (tables_used->table->db_type == DB_TYPE_MRG_MYISAM)
+ if (tables_used->derived)
+ {
+ table_count--;
+ DBUG_PRINT("qcache", ("derived table skipped"));
+ }
+ else if (tables_used->table->db_type == DB_TYPE_MRG_MYISAM)
{
ha_myisammrg *handler = (ha_myisammrg *)tables_used->table->file;
MYRG_INFO *file = handler->myrg_info();