Skip to content

Commit 21778b8

Browse files
committed
Merge 10.5 into 10.6
2 parents 764ca7e + 6646591 commit 21778b8

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

mysql-test/main/distinct.result

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,3 +1070,39 @@ UNION
10701070
1
10711071
drop table t1;
10721072
End of 5.5 tests
1073+
#
1074+
# MDEV-27382: OFFSET is ignored when it is combined with the DISTINCT, IN() and JOIN
1075+
#
1076+
CREATE TABLE t1 (
1077+
id int(7) NOT NULL AUTO_INCREMENT,
1078+
name varchar(50) DEFAULT NULL,
1079+
primary key (id)
1080+
);
1081+
INSERT INTO t1 VALUES (1, 'Reed'), (10, 'no-child');
1082+
CREATE TABLE t2 (
1083+
id int(11) NOT NULL AUTO_INCREMENT,
1084+
parent_id int(7) NOT NULL,
1085+
name varchar(100) DEFAULT NULL,
1086+
primary key (id),
1087+
key(parent_id)
1088+
);
1089+
INSERT INTO t2 VALUES (1, 1,'John'), (2, 2,'no-parent');
1090+
SELECT DISTINCT p.id
1091+
FROM t1 p LEFT JOIN t2 c ON p.id = c.parent_id
1092+
WHERE p.id=1
1093+
LIMIT 0;
1094+
id
1095+
SELECT DISTINCT p.id
1096+
FROM t1 p LEFT JOIN t2 c ON p.id = c.parent_id
1097+
WHERE p.id=1
1098+
LIMIT 0 offset 5;
1099+
id
1100+
# Test the second part of the fix: just check that "LIMIT 0 OFFSET n" is
1101+
# handled in the same way as "LIMIT 0"
1102+
explain select * from t1 limit 0;
1103+
id select_type table type possible_keys key key_len ref rows Extra
1104+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit
1105+
explain select * from t1 limit 0 offset 10;
1106+
id select_type table type possible_keys key key_len ref rows Extra
1107+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit
1108+
drop table t1, t2;

mysql-test/main/distinct.test

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,3 +818,41 @@ UNION
818818
drop table t1;
819819

820820
--echo End of 5.5 tests
821+
822+
--echo #
823+
--echo # MDEV-27382: OFFSET is ignored when it is combined with the DISTINCT, IN() and JOIN
824+
--echo #
825+
CREATE TABLE t1 (
826+
id int(7) NOT NULL AUTO_INCREMENT,
827+
name varchar(50) DEFAULT NULL,
828+
primary key (id)
829+
);
830+
INSERT INTO t1 VALUES (1, 'Reed'), (10, 'no-child');
831+
832+
CREATE TABLE t2 (
833+
id int(11) NOT NULL AUTO_INCREMENT,
834+
parent_id int(7) NOT NULL,
835+
name varchar(100) DEFAULT NULL,
836+
primary key (id),
837+
key(parent_id)
838+
);
839+
840+
INSERT INTO t2 VALUES (1, 1,'John'), (2, 2,'no-parent');
841+
842+
SELECT DISTINCT p.id
843+
FROM t1 p LEFT JOIN t2 c ON p.id = c.parent_id
844+
WHERE p.id=1
845+
LIMIT 0;
846+
847+
SELECT DISTINCT p.id
848+
FROM t1 p LEFT JOIN t2 c ON p.id = c.parent_id
849+
WHERE p.id=1
850+
LIMIT 0 offset 5;
851+
852+
--echo # Test the second part of the fix: just check that "LIMIT 0 OFFSET n" is
853+
--echo # handled in the same way as "LIMIT 0"
854+
855+
explain select * from t1 limit 0;
856+
explain select * from t1 limit 0 offset 10;
857+
858+
drop table t1, t2;

mysql-test/suite/galera/disabled.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ GCF-939 : MDEV-21520 galera.GCF-939
1515
MDEV-20225 : MDEV-20886 galera.MDEV-20225
1616
MW-328A : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
1717
MW-328B : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
18+
MW-328D : MDEV-27550 ER_LOCK_DEADLOCK is gone after MDEV-27025
1819
MW-329 : MDEV-19962 Galera test failure on MW-329
1920
galera_applier_ftwrl_table_alter : MDEV-26502 : galera.galera_applier_ftwrl_table_alter MTR failed : Result content mismatch
2021
galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event()

sql/sql_limit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class Select_limit_counters
3737

3838
void set_limit(ha_rows limit, ha_rows offset, bool with_ties_arg)
3939
{
40+
if (limit == 0)
41+
offset= 0;
4042
offset_limit_cnt= offset;
4143
select_limit_cnt= limit;
4244
with_ties= with_ties_arg;

0 commit comments

Comments
 (0)