1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-30066 (limit + offset) union all (...) limit = incorrect result

select_union_direct::send_data() only sends a record when
the LIMIT ... OFFSET clause of the individual select won't skip it.

Thus, select_union_direct::send_data() should not do any actions
related to a sending a record if the offset of a select isn't
reached yet
This commit is contained in:
Sergei Golubchik
2022-11-23 00:58:07 +01:00
parent da3fc33e88
commit cfb47ddde2
3 changed files with 32 additions and 5 deletions

View File

@ -1982,6 +1982,15 @@ union (select 0 as a, 99 as b,
drop table t1,t2;
--echo #
--echo # MDEV-30066 (limit + offset) union all (...) limit = incorrect result
--echo #
create table t1(id int primary key auto_increment, c1 int);
insert into t1(c1) values(1),(2),(3);
(select * from t1 where c1>=1 order by c1 desc limit 2,1) union all (select * from t1 where c1>1 order by c1 desc);
(select * from t1 where c1>=1 order by c1 desc limit 2,1) union all (select * from t1 where c1>1 order by c1 desc) limit 2;
drop table t1;
--echo #
--echo # End of 10.3 tests
--echo #