summaryrefslogtreecommitdiff
path: root/sql/sql_union.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-05-27 00:03:55 -0700
committerIgor Babaev <igor@askmonty.org>2011-05-27 00:03:55 -0700
commitc9a349488b95a9a938564fe1ac06dafc70db5864 (patch)
treedb5bff7867f4d077edaf2a9c9b4a737e25973dbf /sql/sql_union.cc
parent317e04ce67d97ab4a11582236f1e46ccf25c94fb (diff)
downloadmariadb-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/sql_union.cc')
-rw-r--r--sql/sql_union.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 255f5311ac3..c6a6349fd4e 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -944,3 +944,27 @@ void st_select_lex::cleanup_all_joins(bool full)
for (sl= unit->first_select(); sl; sl= sl->next_select())
sl->cleanup_all_joins(full);
}
+
+
+/**
+ Set exclude_from_table_unique_test for selects of this unit and all
+ underlying selects.
+
+ @note used to exclude materialized derived tables (views) from unique
+ table check.
+*/
+
+void st_select_lex_unit::set_unique_exlude()
+{
+ for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select())
+ {
+ sl->exclude_from_table_unique_test= TRUE;
+ for (SELECT_LEX_UNIT *unit= sl->first_inner_unit();
+ unit;
+ unit= unit->next_unit())
+ {
+ unit->set_unique_exlude();
+ }
+ }
+}
+