diff options
author | Varun Gupta <varunraiko1803@gmail.com> | 2017-01-21 00:56:33 +0530 |
---|---|---|
committer | Varun Gupta <varunraiko1803@gmail.com> | 2017-01-21 00:56:33 +0530 |
commit | 213fc700b64a38d64efceef2a2ef8de9748a8ce5 (patch) | |
tree | 324e50bccf4710a5bb8effbd87d0842556f1c917 /mysql-test | |
parent | 8a4d605500ae487d3dc515305662769645bb092f (diff) | |
download | mariadb-git-213fc700b64a38d64efceef2a2ef8de9748a8ce5.tar.gz |
MDEV-10232: Scalar result of subquery changes after adding an outer select stmt
In a subquery, we don't have to maintain order
Added a fix such that order is considered when there is a limit clause.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/subselect4.result | 12 | ||||
-rw-r--r-- | mysql-test/t/subselect4.test | 10 |
2 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index 8b912e1bfe9..3783ba12db2 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -2442,3 +2442,15 @@ i drop table t1, t2, t3; SET optimizer_switch= @@global.optimizer_switch; set @@tmp_table_size= @@global.tmp_table_size; +# +# MDEV-10232 Scalar result of subquery changes after adding an outer select stmt +# +create table t1(c1 int, c2 int, primary key(c2)); +insert into t1 values(2,1),(1,2); +select (select c1 from t1 group by c1,c2 order by c1 limit 1) as x; +x +1 +(select c1 from t1 group by c1,c2 order by c1 limit 1); +c1 +1 +drop table t1; diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index cb102f8319e..253160c46ac 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -1999,3 +1999,13 @@ drop table t1, t2, t3; SET optimizer_switch= @@global.optimizer_switch; set @@tmp_table_size= @@global.tmp_table_size; + +--echo # +--echo # MDEV-10232 Scalar result of subquery changes after adding an outer select stmt +--echo # + +create table t1(c1 int, c2 int, primary key(c2)); +insert into t1 values(2,1),(1,2); +select (select c1 from t1 group by c1,c2 order by c1 limit 1) as x; +(select c1 from t1 group by c1,c2 order by c1 limit 1); +drop table t1; |