From a5b18613ec7966ff1aaa30fe0685fbd7fef8f7c9 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Sun, 21 Feb 2021 22:01:24 -0800 Subject: MDEV-24936 EXPLAIN for query based on table value constructor lacks info on used subqueries If a query was based on a table value constructor that contained subqueries then EXPLAIN for such query did not contain any lines explaining the execution plans of the subqueries. This happened because - no optimize() method was called for any subquery used by the table value constructor when EXPLAIN command for the query was processed; - EXPLAIN node created for the table value constructor itself did not assume that some child nodes could be attached to it. Approved by Oleksandr Byelkin --- mysql-test/main/table_value_constr.test | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'mysql-test/main/table_value_constr.test') diff --git a/mysql-test/main/table_value_constr.test b/mysql-test/main/table_value_constr.test index bac85ff75cc..0a78fd9b386 100644 --- a/mysql-test/main/table_value_constr.test +++ b/mysql-test/main/table_value_constr.test @@ -1434,4 +1434,29 @@ eval explain extended $q; drop table t1; +--echo # +--echo # MDEV-24934:EXPLAIN for queries based on TVC using subqueries +--echo # + +create table t1 (a int); +insert into t1 values (3), (7), (1); + +let $q1= +values (8), ((select * from t1 where a between 2 and 4)); +eval $q1; +eval explain $q1; + +let $q2= +values ((select * from t1 where a between 2 and 4)), + ((select * from t1 where a > 10)); +eval $q2; +eval explain $q2; + +let $q3= +values (10,11), ((select * from t1 where a = 7) + 1, 21); +eval $q3; +eval explain $q3; + +drop table t1; + --echo End of 10.3 tests -- cgit v1.2.1