Commit 21778b8a authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.5 into 10.6

parents 764ca7e6 66465914
......@@ -1070,3 +1070,39 @@ UNION
1
drop table t1;
End of 5.5 tests
#
# MDEV-27382: OFFSET is ignored when it is combined with the DISTINCT, IN() and JOIN
#
CREATE TABLE t1 (
id int(7) NOT NULL AUTO_INCREMENT,
name varchar(50) DEFAULT NULL,
primary key (id)
);
INSERT INTO t1 VALUES (1, 'Reed'), (10, 'no-child');
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
parent_id int(7) NOT NULL,
name varchar(100) DEFAULT NULL,
primary key (id),
key(parent_id)
);
INSERT INTO t2 VALUES (1, 1,'John'), (2, 2,'no-parent');
SELECT DISTINCT p.id
FROM t1 p LEFT JOIN t2 c ON p.id = c.parent_id
WHERE p.id=1
LIMIT 0;
id
SELECT DISTINCT p.id
FROM t1 p LEFT JOIN t2 c ON p.id = c.parent_id
WHERE p.id=1
LIMIT 0 offset 5;
id
# Test the second part of the fix: just check that "LIMIT 0 OFFSET n" is
# handled in the same way as "LIMIT 0"
explain select * from t1 limit 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit
explain select * from t1 limit 0 offset 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit
drop table t1, t2;
......@@ -818,3 +818,41 @@ UNION
drop table t1;
--echo End of 5.5 tests
--echo #
--echo # MDEV-27382: OFFSET is ignored when it is combined with the DISTINCT, IN() and JOIN
--echo #
CREATE TABLE t1 (
id int(7) NOT NULL AUTO_INCREMENT,
name varchar(50) DEFAULT NULL,
primary key (id)
);
INSERT INTO t1 VALUES (1, 'Reed'), (10, 'no-child');
CREATE TABLE t2 (
id int(11) NOT NULL AUTO_INCREMENT,
parent_id int(7) NOT NULL,
name varchar(100) DEFAULT NULL,
primary key (id),
key(parent_id)
);
INSERT INTO t2 VALUES (1, 1,'John'), (2, 2,'no-parent');
SELECT DISTINCT p.id
FROM t1 p LEFT JOIN t2 c ON p.id = c.parent_id
WHERE p.id=1
LIMIT 0;
SELECT DISTINCT p.id
FROM t1 p LEFT JOIN t2 c ON p.id = c.parent_id
WHERE p.id=1
LIMIT 0 offset 5;
--echo # Test the second part of the fix: just check that "LIMIT 0 OFFSET n" is
--echo # handled in the same way as "LIMIT 0"
explain select * from t1 limit 0;
explain select * from t1 limit 0 offset 10;
drop table t1, t2;
......@@ -15,6 +15,7 @@ GCF-939 : MDEV-21520 galera.GCF-939
MDEV-20225 : MDEV-20886 galera.MDEV-20225
MW-328A : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
MW-328B : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
MW-328D : MDEV-27550 ER_LOCK_DEADLOCK is gone after MDEV-27025
MW-329 : MDEV-19962 Galera test failure on MW-329
galera_applier_ftwrl_table_alter : MDEV-26502 : galera.galera_applier_ftwrl_table_alter MTR failed : Result content mismatch
galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event()
......
......@@ -37,6 +37,8 @@ class Select_limit_counters
void set_limit(ha_rows limit, ha_rows offset, bool with_ties_arg)
{
if (limit == 0)
offset= 0;
offset_limit_cnt= offset;
select_limit_cnt= limit;
with_ties= with_ties_arg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment