1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Fixed bug mdev-10773.

The temporary tables created for recursive table references
should be closed in close_thread_tables(), because they might
be used in the statements like ANALYZE WITH r AS (...) SELECT * from r
where r is defined through recursion.
This commit is contained in:
Igor Babaev
2017-01-28 14:52:19 -08:00
parent 64b5e94236
commit abfcdb8fbc
5 changed files with 108 additions and 1 deletions

View File

@@ -2343,3 +2343,68 @@ select id + 1, uuid() from data_generator where id < 150000
select * from data_generator
) as a;
drop table t1;
#
# MDEV-10773: ANALYZE for query with recursive CTE
#
analyze format=json
with recursive src(counter) as
(select 1
union
select counter+1 from src where counter<10
) select * from src;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 10,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
"materialized": {
"query_block": {
"recursive_union": {
"table_name": "<union2,3>",
"access_type": "ALL",
"r_loops": 0,
"r_rows": null,
"query_specifications": [
{
"query_block": {
"select_id": 2,
"table": {
"message": "No tables used"
}
}
},
{
"query_block": {
"select_id": 3,
"r_loops": 10,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"r_loops": 10,
"rows": 2,
"r_rows": 1,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 90,
"attached_condition": "src.counter < 10"
}
}
}
]
}
}
}
}
}
}