summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_gconcat.test
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2005-07-28 19:11:29 -0700
committerunknown <igor@rurik.mysql.com>2005-07-28 19:11:29 -0700
commit21d2fb6287347659dd6ce5835ddf16cd3be50279 (patch)
tree8e54c9874df89c6e578ffdefa6b2843f8bcf9b37 /mysql-test/t/func_gconcat.test
parent0ad1836d23d67e13c88b2c45d253844303503cc0 (diff)
downloadmariadb-git-21d2fb6287347659dd6ce5835ddf16cd3be50279.tar.gz
func_gconcat.result, func_gconcat.test:
Added a test case for bug #12095. sql_class.h: Fixed bug #12095: a join query with GROUP_CONCAT over a single row table. Added a flag to the TMP_TABLE_PARAM class forcing to put constant items generated after elimination of a single row table into temp table in some cases (e.g. when GROUP_CONCAT is calculated over a single row table). bk ci sql/item_sum.cc Fixed bug #12095: a join query with GROUP_CONCAT over a single row table. If GROUP_CONCAT is calculated we always put its argument into a temp table, even when the argument is a constant item. sql_select.cc: Fixed bug #12095: a join query with GROUP_CONCAT over one row table. If temp table is used to calculate GROUP_CONCAT the argument should be always put into this table, even when it is a constant item. sql/sql_select.cc: Fixed bug #12095: a join query with GROUP_CONCAT over one row table. If temp table is used to calculate GROUP_CONCAT the argument should be always put into this table, even when it is a constant item. sql/sql_class.h: Fixed bug #12095: a join query with GROUP_CONCAT over a single row table. Added a flag to the TMP_TABLE_PARAM class forcing to put constant items generated after elimination of a single row table into temp table in some cases (e.g. when GROUP_CONCAT is calculated over a single row table). bk ci sql/item_sum.cc Fixed bug #12095: a join query with GROUP_CONCAT over a single row table. If GROUP_CONCAT is calculated we always put its argument into a temp table, even when the argument is a constant item. mysql-test/t/func_gconcat.test: Added a test case for bug #12095. mysql-test/r/func_gconcat.result: Added a test case for bug #12095.
Diffstat (limited to 'mysql-test/t/func_gconcat.test')
-rw-r--r--mysql-test/t/func_gconcat.test33
1 files changed, 33 insertions, 0 deletions
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index e93ffcb17b3..9793d0d0a2c 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -310,4 +310,37 @@ select a, group_concat(b order by b) from t1 group by a with rollup;
select a, group_concat(distinct b order by b) from t1 group by a with rollup;
drop table t1;
+#
+# Bug #12095: GROUP_CONCAT for one row table
+#
+
+CREATE TABLE t1 (
+ aID smallint(5) unsigned NOT NULL auto_increment,
+ sometitle varchar(255) NOT NULL default '',
+ bID smallint(5) unsigned NOT NULL,
+ PRIMARY KEY (aID),
+ UNIQUE KEY sometitle (sometitle)
+);
+INSERT INTO t1 SET sometitle = 'title1', bID = 1;
+INSERT INTO t1 SET sometitle = 'title2', bID = 1;
+
+CREATE TABLE t2 (
+ bID smallint(5) unsigned NOT NULL auto_increment,
+ somename varchar(255) NOT NULL default '',
+ PRIMARY KEY (bID),
+ UNIQUE KEY somename (somename)
+);
+INSERT INTO t2 SET somename = 'test';
+
+SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
+ FROM t1 JOIN t2 ON t1.bID = t2.bID;
+INSERT INTO t2 SET somename = 'test2';
+SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
+ FROM t1 JOIN t2 ON t1.bID = t2.bID;
+DELETE FROM t2 WHERE somename = 'test2';
+SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
+ FROM t1 JOIN t2 ON t1.bID = t2.bID;
+
+DROP TABLE t1,t2;
+
# End of 4.1 tests