mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 11:27:39 +02: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:
parent
a5b534a08e
commit
66ec79fc87
4 changed files with 101 additions and 2 deletions
|
|
@ -17404,7 +17404,13 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
|
|||
if (!end_of_records)
|
||||
{
|
||||
if (join->table_count &&
|
||||
join->join_tab->is_using_loose_index_scan())
|
||||
(join->join_tab->is_using_loose_index_scan() ||
|
||||
/*
|
||||
When order by used a loose scan as its input, the quick select may
|
||||
be attached to pre_sort_join_tab.
|
||||
*/
|
||||
(join->pre_sort_join_tab &&
|
||||
join->pre_sort_join_tab->is_using_loose_index_scan())))
|
||||
{
|
||||
/* Copy non-aggregated fields when loose index scan is used. */
|
||||
copy_fields(&join->tmp_table_param);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue