1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-30706 Different results of selects from view and CTE with same definition

MDEV-30668 Set function aggregated in outer select used in view definition

This patch fixes two bugs concerning views whose specifications contain
subqueries with set functions aggregated in outer selects.
Due to the first bug those such views that have implicit grouping were
considered as mergeable. This led to wrong result sets for selects from
these views.
Due to the second bug the aggregation select was determined incorrectly and
this led to bogus error messages.
The patch added several test cases for these two bugs and for four other
duplicate bugs.
The patch also enables view-protocol for many other test cases.

Approved by Oleksandr Byelkin <sanja@mariadb.com>
This commit is contained in:
Igor Babaev
2023-03-01 22:49:27 -08:00
parent a6a906d766
commit ccec9b1de9
23 changed files with 2021 additions and 722 deletions

View File

@ -351,24 +351,6 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived)
DBUG_RETURN(FALSE);
}
if (dt_select->uncacheable & UNCACHEABLE_RAND)
{
/* There is random function => fall back to materialization. */
cause= "Random function in the select";
if (unlikely(thd->trace_started()))
{
OPT_TRACE_VIEWS_TRANSFORM(thd, trace_wrapper, trace_derived,
derived->is_derived() ? "derived" : "view",
derived->alias.str ? derived->alias.str : "<NULL>",
derived->get_unit()->first_select()->select_number,
"materialized");
trace_derived.add("cause", cause);
}
derived->change_refs_to_fields();
derived->set_materialized_derived();
DBUG_RETURN(FALSE);
}
if (derived->dt_handler)
{
derived->change_refs_to_fields();