diff options
| author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-11-02 10:42:34 +0100 |
|---|---|---|
| committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-11-02 13:08:01 +0100 |
| commit | ad937cf33a44892b2db43a6f18a5c80c78bcf163 (patch) | |
| tree | 11123aea6ca1b143f0c40d1a1f785b0b3bab8a2d /sql/sql_explain.cc | |
| parent | 093ec49b6b6948ee8d5a560cd2f862e38844c223 (diff) | |
| parent | 49a22c5897823c528d52886f6048d5b4c91e221f (diff) | |
| download | mariadb-git-ad937cf33a44892b2db43a6f18a5c80c78bcf163.tar.gz | |
Merge branch '10.10' into 10.11
Diffstat (limited to 'sql/sql_explain.cc')
| -rw-r--r-- | sql/sql_explain.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index ede486fc297..50b016138dc 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -753,7 +753,11 @@ int Explain_node::print_explain_for_children(Explain_query *query, for (int i= 0; i < (int) children.elements(); i++) { Explain_node *node= query->get_node(children.at(i)); - if (node->print_explain(query, output, explain_flags, is_analyze)) + /* + Note: node may not be present because for certain kinds of subqueries, + the optimizer is not able to see that they were eliminated. + */ + if (node && node->print_explain(query, output, explain_flags, is_analyze)) return 1; } return 0; @@ -798,8 +802,15 @@ void Explain_node::print_explain_json_for_children(Explain_query *query, for (int i= 0; i < (int) children.elements(); i++) { Explain_node *node= query->get_node(children.at(i)); - /* Derived tables are printed inside Explain_table_access objects */ + /* + Note: node may not be present because for certain kinds of subqueries, + the optimizer is not able to see that they were eliminated. + */ + if (!node) + continue; + + /* Derived tables are printed inside Explain_table_access objects */ if (!is_connection_printable_in_json(node->connection_type)) continue; |
