diff options
author | unknown <mhansson/martin@linux-st28.site> | 2008-01-11 19:00:26 +0100 |
---|---|---|
committer | unknown <mhansson/martin@linux-st28.site> | 2008-01-11 19:00:26 +0100 |
commit | 7bd7e988122864c1a86b65cdcd1de900ab82745f (patch) | |
tree | 21f2ef5e2bbd17ae2970f14bad81c06f55fd4325 /mysql-test/t/group_by.test | |
parent | 84762ce2cb01d352858dfff14afa9debffd14d8a (diff) | |
parent | df8e9fc234234958ee0cb6195b724657b2cd128c (diff) | |
download | mariadb-git-7bd7e988122864c1a86b65cdcd1de900ab82745f.tar.gz |
Merge mhansson@bk-internal:/home/bk/mysql-5.0-opt
into linux-st28.site:/home/martin/mysql/src/bug31797/my50-bug31797-pushee
sql/item.cc:
Auto merged
mysql-test/r/group_by.result:
Bug#31797: Manual merge
mysql-test/t/group_by.test:
Bug#31797: Manual merge
Diffstat (limited to 'mysql-test/t/group_by.test')
-rw-r--r-- | mysql-test/t/group_by.test | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index b150db6dafe..636544f7854 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -849,4 +849,48 @@ SELECT * FROM t1 GROUP BY c2 ORDER BY c2 DESC, c1 DESC; DROP TABLE t1; +# Bug #31797: error while parsing subqueries -- WHERE is parsed as HAVING +# +CREATE TABLE t1 ( a INT, b INT ); + +SELECT b c, (SELECT a FROM t1 WHERE b = c) +FROM t1; + +SELECT b c, (SELECT a FROM t1 WHERE b = c) +FROM t1 +HAVING b = 10; + +--error ER_ILLEGAL_REFERENCE +SELECT MAX(b) c, (SELECT a FROM t1 WHERE b = c) +FROM t1 +HAVING b = 10; + +SET @old_sql_mode = @@sql_mode; +SET @@sql_mode='ONLY_FULL_GROUP_BY'; + +SELECT b c, (SELECT a FROM t1 WHERE b = c) +FROM t1; + +--error ER_NON_GROUPING_FIELD_USED +SELECT b c, (SELECT a FROM t1 WHERE b = c) +FROM t1 +HAVING b = 10; + +--error ER_ILLEGAL_REFERENCE +SELECT MAX(b) c, (SELECT a FROM t1 WHERE b = c) +FROM t1 +HAVING b = 10; + +INSERT INTO t1 VALUES (1, 1); +SELECT b c, (SELECT a FROM t1 WHERE b = c) +FROM t1; + +INSERT INTO t1 VALUES (2, 1); +--error ER_SUBQUERY_NO_1_ROW +SELECT b c, (SELECT a FROM t1 WHERE b = c) +FROM t1; + +DROP TABLE t1; +SET @@sql_mode = @old_sql_mode; + --echo End of 5.0 tests |