mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix for MDEV-4219 A simple select query returns random data (upstream bug#68473)
In the case of loose scan used as input for order by, end_send() didn't detect correctly that a loose scan was used, and didn't copy the non-aggregated fields from the temp table used for ORDER BY. The fix uses the fact that the quick select used for sorting is attached to JOIN::pre_sort_join_tab instead of JOIN::join_tab.
This commit is contained in:
@ -13217,7 +13217,11 @@ QUICK_GROUP_MIN_MAX_SELECT::~QUICK_GROUP_MIN_MAX_SELECT()
|
||||
DBUG_ASSERT(file == head->file);
|
||||
if (doing_key_read)
|
||||
head->disable_keyread();
|
||||
file->ha_index_end();
|
||||
/*
|
||||
There may be a code path when the same table was first accessed by index,
|
||||
then the index is closed, and the table is scanned (order by + loose scan).
|
||||
*/
|
||||
file->ha_index_or_rnd_end();
|
||||
}
|
||||
if (min_max_arg_part)
|
||||
delete_dynamic(&min_max_ranges);
|
||||
|
Reference in New Issue
Block a user