diff options
author | Igor Babaev <igor@askmonty.org> | 2018-08-21 12:01:25 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2018-08-21 12:27:29 -0700 |
commit | c43d11b96e27f25d248f4740a2274f1bfb1d5845 (patch) | |
tree | 0b00e9753703b2588274650ff7f00bbdbcd01839 /mysql-test/main/table_value_constr.test | |
parent | a1fd25c22bc27e58b802dd83ee48428913351180 (diff) | |
download | mariadb-git-c43d11b96e27f25d248f4740a2274f1bfb1d5845.tar.gz |
MDEV-16930 Crash when VALUES in derived table contains expressions
This patch always provides columns of the temporary table used for
materialization of a table value constructor with some names.
Before this patch these names were always borrowed from the items
of the first row of the table value constructor. When this row
contained expressions and expressions were not named then it could cause
different kinds of problems. In particular if the TVC is used as the
specification of a derived table this could cause a crash.
The names given to the expressions used in a TVC are the same as those
given to the columns of the result set from the corresponding SELECT.
Diffstat (limited to 'mysql-test/main/table_value_constr.test')
-rw-r--r-- | mysql-test/main/table_value_constr.test | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/main/table_value_constr.test b/mysql-test/main/table_value_constr.test index eb30f00fa91..5df40d1047c 100644 --- a/mysql-test/main/table_value_constr.test +++ b/mysql-test/main/table_value_constr.test @@ -1104,3 +1104,24 @@ eval $q4; eval explain $q4; drop table t1; + +--echo # +--echo # MDEV-16930: expression in the first row of TVC specifying derived table +--echo # + +SELECT 1 + 1, 2, "abc"; +SELECT * FROM (SELECT 1 + 1, 2, "abc") t; +WITH cte AS (SELECT 1 + 1, 2, "abc") SELECT * FROM cte; +SELECT 1 + 1, 2, "abc" UNION SELECT 3+4, 3, "abc"; +CREATE VIEW v1 AS SELECT 1 + 1, 2, "abc"; +SELECT * FROM v1; +DROP VIEW v1; + +VALUES(1 + 1,2,"abc"); +SELECT * FROM (VALUES(1 + 1,2,"abc")) t; +PREPARE stmt FROM "SELECT * FROM (VALUES(1 + 1,2,'abc')) t"; +EXECUTE stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + + |