summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2005-07-26 08:25:25 -0700
committerunknown <igor@rurik.mysql.com>2005-07-26 08:25:25 -0700
commit35b575e89317d3062c74914db9bcec8bb8968ffb (patch)
tree3441a2b6c774d72e1e1ba592b27a7e8d50a2b1c1 /mysql-test
parentb6b67acc0c691883d577cae0aeadd8ad422f3819 (diff)
parent8abc41b4955d875e8120e029cda22cea4c34eb20 (diff)
downloadmariadb-git-35b575e89317d3062c74914db9bcec8bb8968ffb.tar.gz
Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-0 sql/item.h: Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/view.result23
-rw-r--r--mysql-test/t/view.test26
2 files changed, 48 insertions, 1 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index c8078a0604e..730e180cbd9 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -2024,3 +2024,26 @@ f1 sb
2005-01-01 12:00:00 2005-01-01 10:58:59
drop view v1;
drop table t1;
+CREATE TABLE t1 (
+aid int PRIMARY KEY,
+fn varchar(20) NOT NULL,
+ln varchar(20) NOT NULL
+);
+CREATE TABLE t2 (
+aid int NOT NULL,
+pid int NOT NULL
+);
+INSERT INTO t1 VALUES(1,'a','b'), (2,'c','d');
+INSERT INTO t2 values (1,1), (2,1), (2,2);
+CREATE VIEW v1 AS SELECT t1.*,t2.pid FROM t1,t2 WHERE t1.aid = t2.aid;
+SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM t1,t2
+WHERE t1.aid = t2.aid GROUP BY pid;
+pid GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1)
+1 a b,c d
+2 c d
+SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM v1 GROUP BY pid;
+pid GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1)
+1 a b,c d
+2 c d
+DROP VIEW v1;
+DROP TABLE t1,t2;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 16a94820596..5454b3409da 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -1862,4 +1862,28 @@ insert into t1 values('2005.01.01 12:0:0');
create view v1 as select f1, subtime(f1, '1:1:1') as sb from t1;
select * from v1;
drop view v1;
-drop table t1;
+drop table t1;
+
+#
+# Test for bug #11412: query over a multitable view with GROUP_CONCAT
+#
+CREATE TABLE t1 (
+ aid int PRIMARY KEY,
+ fn varchar(20) NOT NULL,
+ ln varchar(20) NOT NULL
+);
+CREATE TABLE t2 (
+ aid int NOT NULL,
+ pid int NOT NULL
+);
+INSERT INTO t1 VALUES(1,'a','b'), (2,'c','d');
+INSERT INTO t2 values (1,1), (2,1), (2,2);
+
+CREATE VIEW v1 AS SELECT t1.*,t2.pid FROM t1,t2 WHERE t1.aid = t2.aid;
+
+SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM t1,t2
+ WHERE t1.aid = t2.aid GROUP BY pid;
+SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM v1 GROUP BY pid;
+
+DROP VIEW v1;
+DROP TABLE t1,t2;