diff options
| author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-10-25 10:04:37 +0300 |
|---|---|---|
| committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-10-25 10:04:37 +0300 |
| commit | 667d3fbbb51044b20d23150992adbbad1f04aad8 (patch) | |
| tree | 6bf1006a9ea5e68f18387205bd224e7c5698278f /sql/sql_explain.cc | |
| parent | f19e8559aa3f46c0be427c9bd6534432bc08160c (diff) | |
| parent | 34ff5ca8952ff58d99be5028a5920bfe5268f17a (diff) | |
| download | mariadb-git-667d3fbbb51044b20d23150992adbbad1f04aad8.tar.gz | |
Merge 10.3 into 10.4
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 860e840f34e..1681da63ac1 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -662,7 +662,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; @@ -706,8 +710,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; |
