1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +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

@ -24640,7 +24640,7 @@ JOIN_TAB::remove_duplicates()
!(join->select_options & OPTION_FOUND_ROWS))
{
// only const items with no OPTION_FOUND_ROWS
join->unit->lim.set_single_row(); // Only send first row
join->unit->lim.send_first_row(); // Only send first row
my_free(sortorder);
DBUG_RETURN(false);
}