mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-8789 Implement non-recursive common table expressions
Initial implementation
This commit is contained in:
committed by
Igor Babaev
parent
12b86beac8
commit
dfc4772f83
@ -53,6 +53,7 @@
|
||||
#include "log_slow.h"
|
||||
#include "sql_derived.h"
|
||||
#include "sql_statistics.h"
|
||||
#include "sql_cte.h"
|
||||
|
||||
#include "debug_sync.h" // DEBUG_SYNC
|
||||
#include <m_ctype.h>
|
||||
@ -828,6 +829,10 @@ JOIN::prepare(Item ***rref_pointer_array,
|
||||
DBUG_RETURN(-1); /* purecov: inspected */
|
||||
thd->lex->allow_sum_func= save_allow_sum_func;
|
||||
}
|
||||
|
||||
With_clause *with_clause=select_lex->get_with_clause();
|
||||
if (with_clause && with_clause->prepare_unreferenced_elements(thd))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
int res= check_and_do_in_subquery_rewrites(this);
|
||||
|
||||
@ -24154,9 +24159,8 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table,
|
||||
|
||||
/* There should be no attempts to save query plans for merged selects */
|
||||
DBUG_ASSERT(!join->select_lex->master_unit()->derived ||
|
||||
join->select_lex->master_unit()->derived->is_materialized_derived());
|
||||
|
||||
explain= NULL;
|
||||
join->select_lex->master_unit()->derived->is_materialized_derived() ||
|
||||
join->select_lex->master_unit()->derived->is_with_table());
|
||||
|
||||
/* Don't log this into the slow query log */
|
||||
|
||||
@ -24665,11 +24669,14 @@ void TABLE_LIST::print(THD *thd, table_map eliminated_tables, String *str,
|
||||
}
|
||||
else if (derived)
|
||||
{
|
||||
// A derived table
|
||||
str->append('(');
|
||||
derived->print(str, query_type);
|
||||
str->append(')');
|
||||
cmp_name= ""; // Force printing of alias
|
||||
if (!derived->derived->is_with_table())
|
||||
{
|
||||
// A derived table
|
||||
str->append('(');
|
||||
derived->print(str, query_type);
|
||||
str->append(')');
|
||||
cmp_name= ""; // Force printing of alias
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user