diff options
author | Igor Babaev <igor@askmonty.org> | 2011-05-27 00:03:55 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2011-05-27 00:03:55 -0700 |
commit | c9a349488b95a9a938564fe1ac06dafc70db5864 (patch) | |
tree | db5bff7867f4d077edaf2a9c9b4a737e25973dbf /sql/table.cc | |
parent | 317e04ce67d97ab4a11582236f1e46ccf25c94fb (diff) | |
download | mariadb-git-c9a349488b95a9a938564fe1ac06dafc70db5864.tar.gz |
Applied Sanja's patch to fix LP bug #784297 in the tree for mwl106.
The patch imposes unconditional materialization for derived tables
used in update and multi-update statements.
Fixed a bug with a wrong order of processing derived tables/views
at the prepare stage that caused a crash for the variant of the
query from test case for bug 52157.
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/table.cc b/sql/table.cc index 290a82eb56a..3e6b683eafb 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -5851,7 +5851,9 @@ bool TABLE_LIST::init_derived(THD *thd, bool init_view) if (!is_view()) { /* A subquery might be forced to be materialized due to a side-effect. */ - if (!is_materialized_derived() && first_select->is_mergeable()) + if (!is_materialized_derived() && first_select->is_mergeable() && + !(thd->lex->sql_command == SQLCOM_UPDATE_MULTI || + thd->lex->sql_command == SQLCOM_UPDATE)) set_merged_derived(); else set_materialized_derived(); @@ -5862,9 +5864,7 @@ bool TABLE_LIST::init_derived(THD *thd, bool init_view) */ if (is_materialized_derived()) { - SELECT_LEX *sl; - for (sl= first_select ;sl ; sl= sl->next_select()) - sl->exclude_from_table_unique_test= TRUE; + unit->master_unit()->set_unique_exlude(); } /* Create field translation for mergeable derived tables/views. |