diff options
author | unknown <igor@olga.mysql.com> | 2007-02-11 19:36:46 -0800 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-02-11 19:36:46 -0800 |
commit | ac8e029357ab18279ce0609eb1d5c898a00a4019 (patch) | |
tree | 111657b6128e2d3abd42ff117bb4b7d460588ec3 /mysql-test/t/view.test | |
parent | 5e42c0de8d0793d3e714e8368dccd3b69e385fab (diff) | |
download | mariadb-git-ac8e029357ab18279ce0609eb1d5c898a00a4019.tar.gz |
Fixed bug #26209.
The function make_unireg_sortorder ignored the fact that any
view field is represented by a 'ref' object.
This could lead to wrong results for the queries containing
both GROUP BY and ORDER BY clauses.
mysql-test/r/view.result:
Added a test case for bug #26209.
mysql-test/t/view.test:
Added a test case for bug #26209.
Diffstat (limited to 'mysql-test/t/view.test')
-rw-r--r-- | mysql-test/t/view.test | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 7fdca1ff7e0..33e381af476 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3038,4 +3038,24 @@ explain extended select * from v1 order by f1; drop view v1; drop table t1; +# +# Bug#26209: queries with GROUP BY and ORDER BY using views +# + +CREATE TABLE t1 ( + id int(11) NOT NULL PRIMARY KEY, + country varchar(32), + code int(11) default NULL +); +INSERT INTO t1 VALUES + (1,'ITALY',100),(2,'ITALY',200),(3,'FRANCE',100), (4,'ITALY',100); + +CREATE VIEW v1 AS SELECT * FROM t1; + +SELECT code, COUNT(DISTINCT country) FROM t1 GROUP BY code ORDER BY MAX(id); +SELECT code, COUNT(DISTINCT country) FROM v1 GROUP BY code ORDER BY MAX(id); + +DROP VIEW v1; +DROP TABLE t1; + --echo End of 5.0 tests. |