diff options
| author | Alexey Botchkov <holyfoot@askmonty.org> | 2021-03-24 15:05:24 +0400 |
|---|---|---|
| committer | Alexey Botchkov <holyfoot@askmonty.org> | 2021-04-21 10:21:44 +0400 |
| commit | 707d8653c46d4f457aecfee4eacf678a2ccc87c7 (patch) | |
| tree | 25b1b226ae1cd98f031c64e1d7cbf2cf3bf20280 | |
| parent | 7075955f4ed655fb1c78031b9f42d16cd5b59389 (diff) | |
| download | mariadb-git-707d8653c46d4f457aecfee4eacf678a2ccc87c7.tar.gz | |
MDEV-25228 JSON_TABLE: Server crashes in Query_cache::unlink_table.
JSON_TABLE shojldn't be counted in the query_cache.
| -rw-r--r-- | mysql-test/main/query_cache.result | 7 | ||||
| -rw-r--r-- | mysql-test/main/query_cache.test | 7 | ||||
| -rw-r--r-- | sql/sql_cache.cc | 6 |
3 files changed, 18 insertions, 2 deletions
diff --git a/mysql-test/main/query_cache.result b/mysql-test/main/query_cache.result index c835e25e396..020c7472694 100644 --- a/mysql-test/main/query_cache.result +++ b/mysql-test/main/query_cache.result @@ -2227,6 +2227,13 @@ SHOW STATUS LIKE 'Qcache_inserts'; Variable_name Value Qcache_inserts 0 drop table t1; +# +# MDEV-25228 JSON_TABLE: Server crashes in Query_cache::unlink_table. +# +CREATE TABLE t (a INT); +SELECT * FROM t JOIN JSON_TABLE('{}' , '$' COLUMNS(b FOR ORDINALITY)) AS jt; +a b +DROP TABLE t; restore defaults SET GLOBAL query_cache_type= default; SET GLOBAL query_cache_size=@save_query_cache_size; diff --git a/mysql-test/main/query_cache.test b/mysql-test/main/query_cache.test index 0d747b97acc..66785b42c36 100644 --- a/mysql-test/main/query_cache.test +++ b/mysql-test/main/query_cache.test @@ -1818,6 +1818,13 @@ select * from t1, json_table(t1.a, '$' columns (f varchar(20) path '$.a')) as jt SHOW STATUS LIKE 'Qcache_inserts'; drop table t1; +--echo # +--echo # MDEV-25228 JSON_TABLE: Server crashes in Query_cache::unlink_table. +--echo # +CREATE TABLE t (a INT); +SELECT * FROM t JOIN JSON_TABLE('{}' , '$' COLUMNS(b FOR ORDINALITY)) AS jt; +DROP TABLE t; + --echo restore defaults SET GLOBAL query_cache_type= default; SET GLOBAL query_cache_size=@save_query_cache_size; diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 80681eee44a..49f42eb95c5 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -4094,11 +4094,13 @@ Query_cache::process_and_count_tables(THD *thd, TABLE_LIST *tables_used, *tables_type|= HA_CACHE_TBL_NONTRANSACT; continue; } - if (tables_used->derived) + if (tables_used->derived || tables_used->table_function) { DBUG_PRINT("qcache", ("table: %s", tables_used->alias.str)); table_count--; - DBUG_PRINT("qcache", ("derived table skipped")); + DBUG_PRINT("qcache", (tables_used->table_function ? + "table function skipped" : + "derived table skipped")); continue; } |
