diff options
author | Igor Babaev <igor@askmonty.org> | 2018-04-21 17:20:20 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2018-04-21 17:20:33 -0700 |
commit | 6242036f2776f7e5ddcd176c14fb3c3b674350ae (patch) | |
tree | d6977f83b77bd291fc05ddf6eb389965c7ec54d4 /mysql-test/main/table_value_constr.test | |
parent | c39f8a80c9fe7f7c5e5af95374d7bf2486f97da7 (diff) | |
download | mariadb-git-6242036f2776f7e5ddcd176c14fb3c3b674350ae.tar.gz |
MDEV-15940 Crash when using CURSOR with VALUES()
The function st_select_lex_unit::get_column_types() should
take into account that a unit may contain only a table
value constructor and nothing more.
Diffstat (limited to 'mysql-test/main/table_value_constr.test')
-rw-r--r-- | mysql-test/main/table_value_constr.test | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/main/table_value_constr.test b/mysql-test/main/table_value_constr.test index 578f8943fbb..84f196b92a2 100644 --- a/mysql-test/main/table_value_constr.test +++ b/mysql-test/main/table_value_constr.test @@ -1044,3 +1044,27 @@ select * from (values (1), (b), (2)) as new_tvc; select * from (values (1), (t1.b), (2)) as new_tvc; drop table t1; + +--echo # +--echo # MDEV-MDEV-15940: cursor over TVC +--echo # + +DELIMITER |; + +BEGIN NOT ATOMIC + DECLARE v INT; + DECLARE cur CURSOR FOR VALUES(7); + OPEN cur; + FETCH cur INTO v; + SELECT v; +END; +| + +BEGIN NOT ATOMIC +DECLARE v INT DEFAULT 0; +FOR a IN (VALUES (7)) DO SET v = v + 1; END FOR; +SELECT v; +END; +| + +DELIMITER ;| |