diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index b5b944583da8d4676c77328e14c16926a4c1a5a5..c365c2ed434a4d1975128913532f1573ea883821 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1,6 +1,10 @@ select (select 2); (select 2) 2 +SELECT (SELECT 1) UNION SELECT (SELECT 2); +(SELECT 1) +1 +2 drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit; create table t1 (a int); create table t2 (a int, b int); diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 120cbcbc05f63405d6c0691e69968d4bf1a92dc7..dbf45262a1e256e5b1764b961ffac724a8a657de 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -1,5 +1,6 @@ select (select 2); +SELECT (SELECT 1) UNION SELECT (SELECT 2); drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit; create table t1 (a int); create table t2 (a int, b int); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 09d41e2891b5de1302cb57665c88855b16ed89d0..f7d585e85f89d3af0f3a426a9f27cfaaf260c6d3 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3605,6 +3605,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, case Item::COND_ITEM: case Item::FIELD_AVG_ITEM: case Item::FIELD_STD_ITEM: + case Item::SUBSELECT_ITEM: /* The following can only happen with 'CREATE TABLE ... SELECT' */ case Item::INT_ITEM: case Item::REAL_ITEM: