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

MDEV-16386: Wrong result when pushdown into the HAVING clause of the

materialized derived table/view that uses aliases is done

The problem appears when a column alias inside the materialized derived
table/view t1 definition coincides with the column name used in the
GROUP BY clause of t1. If the condition that can be pushed into t1
uses that ambiguous column name this column is determined as a column that
is used in the GROUP BY clause instead of the alias used in the projection
list of t1. That causes wrong result.
To prevent it resolve_ref_in_select_and_group() was changed.
This commit is contained in:
Galina Shalygina
2018-06-13 16:32:25 +02:00
parent a79b033b35
commit ec4fdd5749
6 changed files with 267 additions and 4 deletions

View File

@ -1350,9 +1350,11 @@ JOIN::optimize_inner()
if (having)
{
select_lex->having_fix_field= 1;
select_lex->having_fix_field_for_pushed_cond= 1;
if (having->fix_fields(thd, &having))
DBUG_RETURN(1);
select_lex->having_fix_field= 0;
select_lex->having_fix_field_for_pushed_cond= 0;
}
}