diff options
author | igor@rurik.mysql.com <> | 2005-07-28 19:11:29 -0700 |
---|---|---|
committer | igor@rurik.mysql.com <> | 2005-07-28 19:11:29 -0700 |
commit | a5f2c7528c9d6238bcd80d8616b29fcf582ae6a9 (patch) | |
tree | 8e54c9874df89c6e578ffdefa6b2843f8bcf9b37 /mysql-test/t/func_gconcat.test | |
parent | f503c4152de0b45d6780d1c669988810055c0fa9 (diff) | |
download | mariadb-git-a5f2c7528c9d6238bcd80d8616b29fcf582ae6a9.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.
Diffstat (limited to 'mysql-test/t/func_gconcat.test')
-rw-r--r-- | mysql-test/t/func_gconcat.test | 33 |
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 |