diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-11-14 19:09:06 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-11-14 19:09:06 +0100 |
commit | 695f20f1b55949ae5e4870805cf0b056457ec932 (patch) | |
tree | 9705fed9d5f37c9f8035f10cbd285a48d982895c /sql/sql_lex.cc | |
parent | dc3782804277ec2c314f4aecc3610aa03220c6db (diff) | |
download | mariadb-git-mariadb-10.10.2-release.tar.gz |
MDEV-30007 SIGSEGV in st_select_lex_unit::is_derived_eliminated, runtime error: member access within null pointer of type 'struct TABLE' in st_select_lex_unit::is_derived_eliminated()mariadb-10.10.2-release
Take into account case of a degenerate subquery (like SELECT 1).
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 5e9d9a8eb17..a01b1547cf1 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -11924,9 +11924,18 @@ bool SELECT_LEX_UNIT::explainable() const false; } +/* + Determines whether the derived table was eliminated during + the call of eliminate_tables(JOIN *) made at the optimization stage + or completely optimized out (for such degenerate statements like + "SELECT 1", for example) +*/ + bool SELECT_LEX_UNIT::is_derived_eliminated() const { if (!derived) return false; + if (!derived->table) + return true; return derived->table->map & outer_select()->join->eliminated_tables; } |