1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 11.0 into 11.1

This commit is contained in:
Marko Mäkelä
2024-03-28 12:15:36 +02:00
727 changed files with 22650 additions and 8324 deletions

View File

@@ -1209,8 +1209,12 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
(derived->alias.str ? derived->alias.str : "<NULL>"),
derived->get_unit()));
if (unit->executed && !unit->uncacheable && !unit->describe &&
!derived_is_recursive)
/*
Only fill derived tables once, unless the derived table is dependent in
which case we will delete all of its rows and refill it below.
*/
if (unit->executed && !(unit->uncacheable & UNCACHEABLE_DEPENDENT) &&
!unit->describe && !derived_is_recursive)
DBUG_RETURN(FALSE);
/*check that table creation passed without problems. */
DBUG_ASSERT(derived->table && derived->table->is_created());
@@ -1225,7 +1229,9 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
/* Execute the query that specifies the derived table by a foreign engine */
res= derived->pushdown_derived->execute();
unit->executed= true;
if (res)
DBUG_RETURN(res);
goto after_exec;
}
if (unit->executed && !derived_is_recursive &&
@@ -1267,6 +1273,7 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
}
else
{
DBUG_ASSERT(!unit->executed || (unit->uncacheable & UNCACHEABLE_DEPENDENT));
SELECT_LEX *first_select= unit->first_select();
unit->set_limit(unit->global_parameters());
if (unit->lim.is_unlimited())
@@ -1286,6 +1293,7 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
derived_result, unit, first_select);
}
after_exec:
if (!res && !derived_is_recursive)
{
if (derived_result->flush())