1
0
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:
Monty
2023-05-22 18:58:45 +03:00
parent cd37e49422
commit 92d2ceac73
4 changed files with 56 additions and 1 deletions

View File

@ -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()