diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2021-07-31 23:19:51 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2021-07-31 23:19:51 +0200 |
commit | ae6bdc6769646a09a8d4d08a42a69174ea677768 (patch) | |
tree | c80afdd0e3238dc5092fdcb1439f1390f9a9040b /sql/sql_lex.cc | |
parent | a49f5525bbe1bb1f4320bd0db066068a81af62d9 (diff) | |
parent | 7841a7eb09208f52fcbab7e80e38c7ca29b1339e (diff) | |
download | mariadb-git-ae6bdc6769646a09a8d4d08a42a69174ea677768.tar.gz |
Merge branch '10.4' into 10.5
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 5784c10a29c..5a39b380855 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -11613,3 +11613,23 @@ bool LEX::map_data_type(const Lex_ident_sys_st &schema_name, type->set_handler(mapped); return false; } + + +bool SELECT_LEX_UNIT::explainable() const +{ + /* + EXPLAIN/ANALYZE unit, when: + (1) if it's a subquery - it's not part of eliminated WHERE/ON clause. + (2) if it's a CTE - it's not hanging (needed for execution) + (3) if it's a derived - it's not merged + if it's not 1/2/3 - it's some weird internal thing, ignore it + */ + return item ? + !item->eliminated : // (1) + with_element ? + derived && derived->derived_result && + !with_element->is_hanging_recursive(): // (2) + derived ? + derived->is_materialized_derived() : // (3) + false; +} |