diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2017-08-07 16:04:38 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2017-08-07 16:04:38 +0300 |
commit | 0b30ce4f31cfbaad9582432d35e3c38464eba08e (patch) | |
tree | 425696ae6cffc0a330fb1df395712933942f4eb1 /sql | |
parent | c508691a9303579e5d614159bc872eeb65b8f84c (diff) | |
download | mariadb-git-0b30ce4f31cfbaad9582432d35e3c38464eba08e.tar.gz |
MDEV-13374: Server crashes in first_linear_tab / st_select_lex::set_explain_type
- Support first_linear_tab() traversal for degenerate joins
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_select.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 90f5e11dd16..ba3760dd948 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8627,7 +8627,7 @@ JOIN_TAB *first_top_level_tab(JOIN *join, enum enum_with_const_tables const_tbls JOIN_TAB *tab= join->join_tab; if (const_tbls == WITHOUT_CONST_TABLES) { - if (join->const_tables == join->table_count) + if (join->const_tables == join->table_count || !tab) return NULL; tab += join->const_tables; } @@ -8650,6 +8650,10 @@ JOIN_TAB *first_linear_tab(JOIN *join, enum enum_with_const_tables const_tbls) { JOIN_TAB *first= join->join_tab; + + if (!first) + return NULL; + if (const_tbls == WITHOUT_CONST_TABLES) first+= join->const_tables; @@ -8736,7 +8740,7 @@ JOIN_TAB *first_depth_first_tab(JOIN* join) { JOIN_TAB* tab; /* This means we're starting the enumeration */ - if (join->const_tables == join->top_join_tab_count) + if (join->const_tables == join->top_join_tab_count || !join->join_tab) return NULL; tab= join->join_tab + join->const_tables; |