mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge 10.2 into 10.3
This commit is contained in:
@@ -3207,6 +3207,38 @@ a
|
||||
1
|
||||
3
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-16086: tmp table for CTE is created as ARIA tables
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
Id int(11) not null AUTO_INCREMENT,
|
||||
Parent varchar(15) not null,
|
||||
Child varchar(15) not null,
|
||||
PRIMARY KEY (Id)
|
||||
) ENGINE = MyISAM;
|
||||
INSERT INTO t1 (Parent, Child) VALUES
|
||||
('123', '456'),('456', '789'),('321', '654'),('654', '987');
|
||||
WITH RECURSIVE cte AS
|
||||
( SELECT b.Parent,
|
||||
b.Child,
|
||||
CAST(CONCAT(b.Child,',') AS CHAR(513)) Path
|
||||
FROM t1 b
|
||||
LEFT OUTER JOIN t1 bc ON b.Child = bc.Parent
|
||||
WHERE bc.Id IS NULL
|
||||
UNION ALL SELECT c.Parent,
|
||||
c.Child,
|
||||
CONCAT(p.Path,c.Child,',') Path
|
||||
FROM t1 c
|
||||
INNER JOIN cte p ON c.Child = p.Parent)
|
||||
SELECT *
|
||||
FROM cte
|
||||
ORDER BY Path;
|
||||
Parent Child Path
|
||||
456 789 789,
|
||||
123 456 789,456,
|
||||
654 987 987,
|
||||
321 654 987,654,
|
||||
DROP TABLE t1;
|
||||
# Start of 10.3 tests
|
||||
#
|
||||
# MDEV-14217 [db crash] Recursive CTE when SELECT includes new field
|
||||
|
Reference in New Issue
Block a user