diff options
author | Igor Babaev <igor@askmonty.org> | 2018-02-05 18:07:31 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2018-02-05 18:07:31 -0800 |
commit | f271100836d8a91a775894ec36b869a66a3145e5 (patch) | |
tree | 179679955378d944a5414dd7022d31f1186f03b7 /mysql-test/t/cte_recursive.test | |
parent | 465979eabfe3acacc0566fa93402e449e1a9f476 (diff) | |
download | mariadb-git-f271100836d8a91a775894ec36b869a66a3145e5.tar.gz |
Fixed mdev-15162 Query with CTE hangs if assignment operator (:=) is used
If setting user variable was used in the specification of a recursive CTE
then Item_func_set_user_var::fix_fields() went into an infinite loop.
Diffstat (limited to 'mysql-test/t/cte_recursive.test')
-rw-r--r-- | mysql-test/t/cte_recursive.test | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/t/cte_recursive.test b/mysql-test/t/cte_recursive.test index d2e33b165f7..5f1a7d4e1bf 100644 --- a/mysql-test/t/cte_recursive.test +++ b/mysql-test/t/cte_recursive.test @@ -2113,3 +2113,15 @@ DROP TABLE a_tbl; --error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT WITH RECURSIVE x AS (SELECT 1,2 UNION ALL SELECT 1 FROM x) SELECT * FROM x; + +--echo # +--echo # MDEV-15162: Setting user variable in recursive CTE +--echo # + +SET @c=1; + +WITH RECURSIVE cte AS + (SELECT 5 + UNION + SELECT @c:=@c+1 FROM cte WHERE @c<3) +SELECT * FROM cte; |