diff options
author | unknown <igor@olga.mysql.com> | 2007-07-20 22:56:19 -0700 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-07-20 22:56:19 -0700 |
commit | 72c6c789cf206977894fc531ada2c253bc0b1806 (patch) | |
tree | 8efd94c8aa5aa66dec81f0d3185617236b009ba4 /sql/sql_select.cc | |
parent | c20595d8a0f2a18c7b6d7d85c6c2b42b5025df8d (diff) | |
download | mariadb-git-72c6c789cf206977894fc531ada2c253bc0b1806.tar.gz |
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.
mysql-test/r/having.result:
Added a test case for bug #29911.
mysql-test/t/having.test:
Added a test case for bug #29911.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 8b5664a7f96..afbffc499ad 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -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); |