diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-08-10 12:24:31 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-08-10 12:24:31 +0200 |
commit | 1ac0bce36e5bf2136cedb1ce1da949f53cce4404 (patch) | |
tree | 7b81481b201c4e64aaa4a70411d992e0fac2289d /mysql-test/main/cte_recursive.test | |
parent | 3b071bad1981a12e76769cbfc31b62fbd7362372 (diff) | |
parent | 65e8506ca9d03967191b6ed207cf107d311f7f99 (diff) | |
download | mariadb-git-1ac0bce36e5bf2136cedb1ce1da949f53cce4404.tar.gz |
Merge branch '10.4' into 10.5mariadb-10.5.17
Diffstat (limited to 'mysql-test/main/cte_recursive.test')
-rw-r--r-- | mysql-test/main/cte_recursive.test | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test index 5964c32061b..5afd445ead0 100644 --- a/mysql-test/main/cte_recursive.test +++ b/mysql-test/main/cte_recursive.test @@ -3168,7 +3168,50 @@ SELECT * FROM cte; DROP TABLE t1; +--echo # +--echo # MDEV-12325 Unexpected data type and truncation when using CTE +--echo # + +CREATE TABLE t1 +( + id INT, mid INT, name TEXT +); +INSERT INTO t1 VALUES (0,NULL,'Name'),(1,0,'Name1'),(2,0,'Name2'),(11,1,'Name11'),(12,1,'Name12'); + +let $query= +WITH RECURSIVE +cteReports (level, id, mid, name) AS +( + SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL + UNION ALL + SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e + INNER JOIN cteReports r ON e.mid = r.id +) +SELECT + level, id, mid, name, + (SELECT name FROM t1 WHERE id= cteReports.mid) AS mname +FROM cteReports ORDER BY level, mid; + +--error ER_WARN_DATA_OUT_OF_RANGE +--eval $query +--error ER_WARN_DATA_OUT_OF_RANGE +--eval create table t2 as $query; +--eval create table t2 ignore as $query; +show create table t2; +--error ER_WARN_DATA_OUT_OF_RANGE +--eval insert into t2 $query; +--eval insert ignore into t2 $query; +drop table t2; +set @@sql_mode=""; +--eval $query +--eval create table t2 as $query; +show create table t2; +set @@sql_mode=default; +drop table t1,t2; + +--echo # --echo # End of 10.3 tests +--echo # --echo # --echo # MDEV-26108: Recursive CTE embedded into another CTE which is used twice |