mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-28285 Unexpected result when combining DISTINCT, subselect and LIMIT
The problem was that when JOIN_TAB::remove_duplicates() noticed there can only be one possible row in the output, it adjusted limits but didn't take into account any possible offset. Fixed by not adjusting limit offset when setting one-row-limit.
This commit is contained in:
@ -52,6 +52,15 @@ class Select_limit_counters
|
||||
select_limit_cnt= 1;
|
||||
}
|
||||
|
||||
/* Send the first row, still honoring offset_limit_cnt */
|
||||
void send_first_row()
|
||||
{
|
||||
/* Guard against overflow */
|
||||
if ((select_limit_cnt= offset_limit_cnt +1 ) == 0)
|
||||
select_limit_cnt= offset_limit_cnt;
|
||||
// with_ties= false; Remove // on merge to 10.6
|
||||
}
|
||||
|
||||
bool is_unlimited()
|
||||
{ return select_limit_cnt == HA_POS_ERROR; }
|
||||
bool is_unrestricted()
|
||||
|
Reference in New Issue
Block a user