Commit da39ca1f authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Merge branch '10.2' of https://github.com/mariadb/server into 10.2

parents e6e24fe8 15b1840f
...@@ -2944,3 +2944,31 @@ limit 1 ...@@ -2944,3 +2944,31 @@ limit 1
); );
ERROR HY000: Unacceptable mutual recursion with anchored table 'cte_1' ERROR HY000: Unacceptable mutual recursion with anchored table 'cte_1'
drop table t1; drop table t1;
#
# mdev-14777: crash caused by the same as in mdev-14755
#
CREATE TABLE t1 (i1 int NOT NULL, i2 int);
CREATE TABLE t2 (d1 int NOT NULL PRIMARY KEY);
CREATE TABLE t3 (i int );
insert into t1 select seq,seq from seq_1_to_100000;
insert into t2 select seq from seq_1000_to_100000;
insert into t3 select seq from seq_1_to_1000;
SELECT *
FROM
(
SELECT *
FROM
(
WITH RECURSIVE rt AS
(
SELECT i2 P, i1 C FROM t1 WHERE i1 IN (SELECT d1 FROM t2)
UNION
SELECT t1.i2 P, rt.C C FROM t1, rt
)
SELECT C,P
FROM ( SELECT P,C FROM rt WHERE NOT EXISTS (SELECT 1 FROM t1) ) Y
) X
WHERE 1 = 1
) K, t3;
C P i
drop table t1,t2,t3;
...@@ -8807,3 +8807,67 @@ EXPLAIN ...@@ -8807,3 +8807,67 @@ EXPLAIN
} }
} }
drop table t1; drop table t1;
#
# MDEV-13454: consequence of mdev-14368 fixed for 5.5
#
SET sql_mode = 'ONLY_FULL_GROUP_BY';
create table t1 (id int, id2 int);
insert into t1 values (1,1),(2,3),(3,4),(7,2);
create table t2(id2 int);
insert t2 values (1),(2),(3);
SELECT * FROM t1
LEFT OUTER JOIN
(SELECT id2, COUNT(*) as ct FROM t2 GROUP BY id2) vc USING (id2)
WHERE (vc.ct>0);
id2 id ct
1 1 1
3 2 1
2 7 1
EXPLAIN FORMAT=JSON SELECT * FROM t1
LEFT OUTER JOIN
(SELECT id2, COUNT(*) as ct FROM t2 GROUP BY id2) vc USING (id2)
WHERE (vc.ct>0);
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"rows": 3,
"filtered": 100,
"attached_condition": "vc.ct > 0",
"materialized": {
"query_block": {
"select_id": 2,
"having_condition": "ct > 0",
"filesort": {
"sort_key": "t2.id2",
"temporary_table": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 3,
"filtered": 100
}
}
}
}
}
},
"block-nl-join": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 4,
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
"attached_condition": "t1.id2 = vc.id2"
}
}
}
DROP TABLE t1,t2;
SET sql_mode = DEFAULT;
...@@ -1998,3 +1998,37 @@ set @var= ...@@ -1998,3 +1998,37 @@ set @var=
); );
drop table t1; drop table t1;
--echo #
--echo # mdev-14777: crash caused by the same as in mdev-14755
--echo #
--source include/have_sequence.inc
CREATE TABLE t1 (i1 int NOT NULL, i2 int);
CREATE TABLE t2 (d1 int NOT NULL PRIMARY KEY);
CREATE TABLE t3 (i int );
insert into t1 select seq,seq from seq_1_to_100000;
insert into t2 select seq from seq_1000_to_100000;
insert into t3 select seq from seq_1_to_1000;
SELECT *
FROM
(
SELECT *
FROM
(
WITH RECURSIVE rt AS
(
SELECT i2 P, i1 C FROM t1 WHERE i1 IN (SELECT d1 FROM t2)
UNION
SELECT t1.i2 P, rt.C C FROM t1, rt
)
SELECT C,P
FROM ( SELECT P,C FROM rt WHERE NOT EXISTS (SELECT 1 FROM t1) ) Y
) X
WHERE 1 = 1
) K, t3;
drop table t1,t2,t3;
...@@ -1565,3 +1565,28 @@ eval $q; ...@@ -1565,3 +1565,28 @@ eval $q;
eval explain format=json $q; eval explain format=json $q;
drop table t1; drop table t1;
--echo #
--echo # MDEV-13454: consequence of mdev-14368 fixed for 5.5
--echo #
SET sql_mode = 'ONLY_FULL_GROUP_BY';
create table t1 (id int, id2 int);
insert into t1 values (1,1),(2,3),(3,4),(7,2);
create table t2(id2 int);
insert t2 values (1),(2),(3);
let $q=
SELECT * FROM t1
LEFT OUTER JOIN
(SELECT id2, COUNT(*) as ct FROM t2 GROUP BY id2) vc USING (id2)
WHERE (vc.ct>0);
eval $q;
eval EXPLAIN FORMAT=JSON $q;
DROP TABLE t1,t2;
SET sql_mode = DEFAULT;
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