summaryrefslogtreecommitdiff
path: root/mysql-test/r/subselect.result
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-07-06 23:47:33 +0200
committerSergei Golubchik <serg@mariadb.org>2017-07-06 23:47:33 +0200
commit89dc445a55156881318ca94ce042dbaf98e53e26 (patch)
tree04da8a074a8ceac347cb21e0c6e2ee1d05a990c6 /mysql-test/r/subselect.result
parent4d2131354914f54f85abf0bb8cb4bdd42d817f73 (diff)
parentf305a7ce4bccbd56520d874e1d81a4f29bc17a96 (diff)
downloadmariadb-git-89dc445a55156881318ca94ce042dbaf98e53e26.tar.gz
Merge branch '5.5' into 10.0
Diffstat (limited to 'mysql-test/r/subselect.result')
-rw-r--r--mysql-test/r/subselect.result22
1 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 623c28ff7ca..f12c437d64a 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -7147,3 +7147,25 @@ SELECT * FROM t1 WHERE f2 <= SOME ( SELECT f1 FROM t1 );
f1 f2
foo bar
DROP TABLE t1;
+#
+# MDEV-10146: Wrong result (or questionable result and behavior)
+# with aggregate function in uncorrelated SELECT subquery
+#
+CREATE TABLE t1 (f1 INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f2 int);
+INSERT INTO t2 VALUES (3);
+SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
+( SELECT MAX(f1) FROM t2 )
+2
+SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
+( SELECT MAX(f1) FROM t2 )
+2
+INSERT INTO t2 VALUES (4);
+SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
+ERROR 21000: Subquery returns more than 1 row
+SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
+ERROR 21000: Subquery returns more than 1 row
+drop view v1;
+drop table t1,t2;