mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
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.
This commit is contained in:
@@ -1819,11 +1819,18 @@ public:
|
||||
uint convert_blob_length;
|
||||
CHARSET_INFO *table_charset;
|
||||
bool schema_table;
|
||||
/*
|
||||
True if GROUP BY and its aggregate functions are already computed
|
||||
by a table access method (e.g. by loose index scan). In this case
|
||||
query execution should not perform aggregation and should treat
|
||||
aggregate functions as normal functions.
|
||||
*/
|
||||
bool precomputed_group_by;
|
||||
|
||||
TMP_TABLE_PARAM()
|
||||
:copy_field(0), group_parts(0),
|
||||
group_length(0), group_null_parts(0), convert_blob_length(0),
|
||||
schema_table(0)
|
||||
schema_table(0), precomputed_group_by(0)
|
||||
{}
|
||||
~TMP_TABLE_PARAM()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user