mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge 10.11 into 11.0
This commit is contained in:
@@ -1497,6 +1497,26 @@ JOIN::prepare(TABLE_LIST *tables_init, COND *conds_init, uint og_num,
|
||||
if (setup_wild(thd, tables_list, fields_list, &all_fields, select_lex, false))
|
||||
DBUG_RETURN(-1);
|
||||
|
||||
/*
|
||||
If the select_lex is immediately contained within a derived table
|
||||
AND this derived table is a CTE
|
||||
WITH supplied column names
|
||||
AND we have the correct number of elements in both lists
|
||||
(mismatches found in mysql_derived_prepare/rename_columns_of_derived_unit)
|
||||
THEN NOW is the time to take a copy of these item_names for
|
||||
later restoration if required.
|
||||
*/
|
||||
TABLE_LIST *derived= select_lex->master_unit()->derived;
|
||||
|
||||
if (derived &&
|
||||
derived->with &&
|
||||
derived->with->column_list.elements &&
|
||||
(derived->with->column_list.elements == select_lex->item_list.elements))
|
||||
{
|
||||
if (select_lex->save_item_list_names(thd))
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
if (thd->lex->current_select->first_cond_optimization)
|
||||
{
|
||||
if ( conds && ! thd->lex->current_select->merged_into)
|
||||
|
Reference in New Issue
Block a user