mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixed bug #29911.
This bug manifested itself for join queries with GROUP BY and HAVING clauses whose SELECT lists contained DISTINCT. It occurred when the optimizer could deduce that the result set would have not more than one row. The bug could lead to wrong result sets for queries of this type because HAVING conditions were erroneously ignored in some cases in the function remove_duplicates.
This commit is contained in:
@ -8118,7 +8118,7 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
|
||||
field_count++;
|
||||
}
|
||||
|
||||
if (!field_count && !(join->select_options & OPTION_FOUND_ROWS))
|
||||
if (!field_count && !(join->select_options & OPTION_FOUND_ROWS) && !having)
|
||||
{ // only const items with no OPTION_FOUND_ROWS
|
||||
join->unit->select_limit_cnt= 1; // Only send first row
|
||||
DBUG_RETURN(0);
|
||||
|
Reference in New Issue
Block a user