diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-06-02 19:08:59 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-06-02 19:08:59 +0200 |
commit | e5daa0946fc33230c0847028c44197672aa1ded6 (patch) | |
tree | 98d1d73291a9a380d31cf181c02927b1b896ef85 /sql/sql_derived.cc | |
parent | 759fa19690bb1bc76a0f0387b1847d975c07acff (diff) | |
parent | a1975dd2c106180ab16836631e6797cff5b4e396 (diff) | |
download | mariadb-git-e5daa0946fc33230c0847028c44197672aa1ded6.tar.gz |
5.3 merge
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r-- | sql/sql_derived.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 4dbec21bf7e..be258c16356 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -392,17 +392,13 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived) if (parent_lex->get_free_table_map(&map, &tablenr)) { /* There is no enough table bits, fall back to materialization. */ - derived->change_refs_to_fields(); - derived->set_materialized_derived(); - goto exit_merge; + goto unconditional_materialization; } if (dt_select->leaf_tables.elements + tablenr > MAX_TABLES) { /* There is no enough table bits, fall back to materialization. */ - derived->change_refs_to_fields(); - derived->set_materialized_derived(); - goto exit_merge; + goto unconditional_materialization; } if (dt_select->options & OPTION_SCHEMA_TABLE) @@ -473,6 +469,15 @@ exit_merge: if (arena) thd->restore_active_arena(arena, &backup); DBUG_RETURN(res); + +unconditional_materialization: + derived->change_refs_to_fields(); + derived->set_materialized_derived(); + if (!derived->table || !derived->table->created) + res= mysql_derived_create(thd, lex, derived); + if (!res) + res= mysql_derived_fill(thd, lex, derived); + goto exit_merge; } |