mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed the bug mdev-13796.
A reference to a CTE may occur not in the master of the CTE specification. In this case if the reference to the CTE is the first one the specification should be detached from its master and attached to the referencing select. Also fixed the TYPE column in the lines of the EXPLAIN output created for CTE tables.
This commit is contained in:
@ -2304,6 +2304,30 @@ st_select_lex_node *st_select_lex_node:: insert_chain_before(
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Detach the node from its master and attach it to a new master
|
||||
*/
|
||||
|
||||
void st_select_lex_node::move_as_slave(st_select_lex_node *new_master)
|
||||
{
|
||||
exclude_from_tree();
|
||||
if (new_master->slave)
|
||||
{
|
||||
st_select_lex_node *curr= new_master->slave;
|
||||
for ( ; curr->next ; curr= curr->next) ;
|
||||
prev= &curr->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
prev= &new_master->slave;
|
||||
new_master->slave= this;
|
||||
}
|
||||
next= 0;
|
||||
master= new_master;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Exclude a node from the tree lex structure, but leave it in the global
|
||||
list of nodes.
|
||||
@ -4404,7 +4428,8 @@ void st_select_lex::set_explain_type(bool on_the_fly)
|
||||
pos_in_table_list=NULL for e.g. post-join aggregation JOIN_TABs.
|
||||
*/
|
||||
if (tab->table && tab->table->pos_in_table_list &&
|
||||
tab->table->pos_in_table_list->with)
|
||||
tab->table->pos_in_table_list->with &&
|
||||
tab->table->pos_in_table_list->with->is_recursive)
|
||||
{
|
||||
uses_cte= true;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user