summaryrefslogtreecommitdiff
path: root/sql/sql_select.h
diff options
context:
space:
mode:
authortimour@mysql.com <>2005-11-30 12:52:12 +0200
committertimour@mysql.com <>2005-11-30 12:52:12 +0200
commit999a73ace546f94b97fca6ecbd3b2a71d675a9b8 (patch)
tree93c8fe49567155c829f0e7241c60faa6b980c051 /sql/sql_select.h
parent519139b63a4003fd9a17d38a249d23ab00ea5a20 (diff)
downloadmariadb-git-999a73ace546f94b97fca6ecbd3b2a71d675a9b8.tar.gz
Fix for BUG#14920 Ordering aggregated result sets corrupts resultset.
The cause of the bug was the use of end_write_group instead of end_write in the case when ORDER BY required a temporary table, which didn't take into account the fact that loose index scan already computes the result of MIN/MAX aggregate functions (and performs grouping). The solution is to call end_write instead of end_write_group and to add the MIN/MAX functions to the list of regular functions so that their values are inserted into the temporary table.
Diffstat (limited to 'sql/sql_select.h')
-rw-r--r--sql/sql_select.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 2f53c9a3b35..b3abd59f2b4 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -140,6 +140,12 @@ typedef struct st_join_table {
nested_join_map embedding_map;
void cleanup();
+ inline bool is_using_loose_index_scan()
+ {
+ return (select && select->quick &&
+ (select->quick->get_type() ==
+ QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX));
+ }
} JOIN_TAB;
enum_nested_loop_state sub_select_cache(JOIN *join, JOIN_TAB *join_tab, bool