diff options
author | Igor Babaev <igor@askmonty.org> | 2021-03-01 09:40:33 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2021-03-01 12:51:19 -0800 |
commit | 0f81ca6a0bb21fbba4bca93a7555f7c8e6357b47 (patch) | |
tree | 5d04b1fe658ac25871d6f6403ceb87606599f1ff /mysql-test | |
parent | c25e6f91da2eb04fe222aac1c79c6a5c1f94c760 (diff) | |
download | mariadb-git-0f81ca6a0bb21fbba4bca93a7555f7c8e6357b47.tar.gz |
MDEV-24919 Crash with subselect formed by table value constructor and
used in set function
If a subselect is formed by a table value constructor (TVC) then the
following transformation is applied at the prepare stage:
VALUES (v1), ... (vn) => SELECT * FROM (VALUES (v1), ... (vn)) tvc_x.
The transformation is performed by the function wrap_tvc() that resets
THD::LEX::current select to the top level select of the result of the
transformation. After the call of wrap_tvc() in the function
Item_subselect::wrap_tvc_into_select() the field THD::LEX::current must be
reset to the same select as before the call. It was not done. As a result
if the subselect formed by a TVC was an argument of a set function then
an assertion was hit in the function Item_sum::check_sum_func().
Approved by Oleksandr Byelkin <sanja@mariadb.com>
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/main/table_value_constr.result | 6 | ||||
-rw-r--r-- | mysql-test/main/table_value_constr.test | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/main/table_value_constr.result b/mysql-test/main/table_value_constr.result index 603f21a772d..d2965ab1f6c 100644 --- a/mysql-test/main/table_value_constr.result +++ b/mysql-test/main/table_value_constr.result @@ -2881,4 +2881,10 @@ NULL deallocate prepare stmt; drop view v1; drop table t1,t2,t3; +# +# MDEV-24919: subselect formed by TVC and used in set function +# +select sum((values(1))); +sum((values(1))) +1 End of 10.3 tests diff --git a/mysql-test/main/table_value_constr.test b/mysql-test/main/table_value_constr.test index 2246a19d306..88d0ac2fbbf 100644 --- a/mysql-test/main/table_value_constr.test +++ b/mysql-test/main/table_value_constr.test @@ -1516,4 +1516,10 @@ deallocate prepare stmt; drop view v1; drop table t1,t2,t3; +--echo # +--echo # MDEV-24919: subselect formed by TVC and used in set function +--echo # + +select sum((values(1))); + --echo End of 10.3 tests |