1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Fix for BUG#8490: In mysql_make_view for join algorithm views we need

to insert view's subqueries into select_lex->slave(->next)* chain. 
In case a join has several such views, don't add the same subqueries several times
(this forms a loop on the above chain which breaks many parts of the code)
This commit is contained in:
sergefp@mysql.com
2005-04-23 00:13:46 +04:00
parent ab0ff5349d
commit 307c0cf908
3 changed files with 43 additions and 3 deletions

View File

@@ -796,17 +796,25 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
/* Store WHERE clause for post-processing in setup_ancestor */
table->where= view_select->where;
/*
Add subqueries units to SELECT in which we merging current view.
Add subqueries units to SELECT into which we merging current view.
unit(->next)* chain starts with subqueries that are used by this
view and continues with subqueries that are used by other views.
We must not add any subquery twice (otherwise we'll form a loop),
to do this we remember in end_unit the first subquery that has
been already added.
NOTE: we do not support UNION here, so we take only one select
*/
SELECT_LEX_NODE *end_unit= table->select_lex->slave;
for (SELECT_LEX_UNIT *unit= lex->select_lex.first_inner_unit();
unit;
unit= unit->next_unit())
{
SELECT_LEX_NODE *save_slave= unit->slave;
if (unit == end_unit)
break;
unit->include_down(table->select_lex);
unit->slave= save_slave; // fix include_down initialisation
}