diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2016-02-03 17:15:22 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2016-02-06 13:36:17 +0100 |
commit | 41021c0254207c914e271fc4dfc910093dd4a92d (patch) | |
tree | 266e75202bb02b9068205809c105e37ead45fd4f /sql/sql_yacc.yy | |
parent | ad94790f468bacb2cd62d02d3a6e7f012ca72e65 (diff) | |
download | mariadb-git-41021c0254207c914e271fc4dfc910093dd4a92d.tar.gz |
MDEV-9462: Out of memory using explain on 2 empty tables
Fixed adding derived tables items to outer one.
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 11d7efdbadf..2cb02059ba4 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -9872,15 +9872,6 @@ table_factor: sel->add_joined_table($$); lex->pop_context(); lex->nest_level--; - /* - Fields in derived table can be used in upper select in - case of merge. We do not add HAVING fields because we do - not merge such derived. We do not add union because - also do not merge them - */ - if (!sel->next_select()) - $2->select_n_where_fields+= - sel->select_n_where_fields; } /*else if (($3->select_lex && $3->select_lex->master_unit()->is_union() && @@ -9901,6 +9892,15 @@ table_factor: nest_level is the same as in the outer query */ $$= $3; } + /* + Fields in derived table can be used in upper select in + case of merge. We do not add HAVING fields because we do + not merge such derived. We do not add union because + also do not merge them + */ + if ($$ && $$->derived && + !$$->derived->first_select()->next_select()) + $$->select_lex->add_where_field($$->derived->first_select()); } ; |