From 5d4d42d39a303379694d51892fd059c7d9510255 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Mon, 13 Jun 2011 19:03:03 -0700 Subject: Fixed LP bug #794890. Changed the code that processing of multi-updates and multi-deletes with multitable views at the prepare stage. A proper solution would be: never to perform any transformations of views before and at the prepare stage. Yet it would require re-engineering of the code that checks privileges and updatability of views. Ultimately this re-engineering has to be done to provide a clean solution for INSERT/UPDATE/DELETE statements that use views. Fixed a valgrind problem in the function TABLE::use_index. --- sql/sql_lex.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sql/sql_lex.h') diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 5a8b5a5f361..57eeb963b89 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -639,6 +639,8 @@ public: */ List leaf_tables; List leaf_tables_exec; + List leaf_tables_prep; + bool is_prep_leaf_list_saved; uint insert_tables; st_select_lex *merged_into; /* select which this select is merged into */ /* (not 0 only for views/derived tables) */ @@ -899,6 +901,7 @@ public: void mark_const_derived(bool empty); bool save_leaf_tables(THD *thd); + bool save_prep_leaf_tables(THD *thd); private: /* current index hint kind. used in filling up index_hints */ -- cgit v1.2.1 From 1eea03ccc489371fa2b438a60accda552ad33e12 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Sat, 16 Jul 2011 23:57:43 -0700 Subject: Fixed LP bug #794901. Also: 1. simplified the code of the function mysql_derived_merge_for_insert. 2. moved merge of views/dt for multi-update/delete to the prepare stage. 3. the list of the references to the candidates for semi-join now is allocated in the statement memory. --- sql/sql_lex.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sql/sql_lex.h') diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 57eeb963b89..14ab445a366 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -637,6 +637,12 @@ public: tables. Unlike 'next_local', this in this list views are *not* leaves. Created in setup_tables() -> make_leaves_list(). */ + /* + Subqueries that will need to be converted to semi-join nests, including + those converted to jtbm nests. The list is emptied when conversion is done. + */ + List sj_subselects; + List leaf_tables; List leaf_tables_exec; List leaf_tables_prep; @@ -886,7 +892,7 @@ public: void remove_table_from_list(TABLE_LIST *table); void remap_tables(TABLE_LIST *derived, table_map map, uint tablenr, st_select_lex *parent_lex); - bool merge_subquery(TABLE_LIST *derived, st_select_lex *subq_lex, + bool merge_subquery(THD *thd, TABLE_LIST *derived, st_select_lex *subq_lex, uint tablenr, table_map map); inline bool is_mergeable() { -- cgit v1.2.1