Below is the list of changes that have just been committed into a local
4.1 repository of igor. When igor does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2359 05/07/28 19:11:29 igor@stripped +4 -0
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.
mysql-test/r/func_gconcat.result
1.38 05/07/28 19:10:32 igor@stripped +31 -0
Added a test case for bug #12095.
mysql-test/t/func_gconcat.test
1.30 05/07/28 19:09:59 igor@stripped +33 -0
Added a test case for bug #12095.
sql/sql_class.h
1.280 05/07/28 19:04:44 igor@stripped +3 -1
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/sql_select.cc
1.425 05/07/28 18:16:46 igor@stripped +2 -1
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.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: igor
# Host: rurik.mysql.com
# Root: /home/igor/dev/mysql-4.1-0
--- 1.279/sql/sql_class.h Thu Jun 16 12:05:33 2005
+++ 1.280/sql/sql_class.h Thu Jul 28 19:04:44 2005
@@ -1325,10 +1325,12 @@
bool using_indirect_summary_function;
/* If >0 convert all blob fields to varchar(convert_blob_length) */
uint convert_blob_length;
+ bool need_const; /* <=> const items are saved in tmp table */
TMP_TABLE_PARAM()
:copy_field(0), group_parts(0),
- group_length(0), group_null_parts(0), convert_blob_length(0)
+ group_length(0), group_null_parts(0), convert_blob_length(0),
+ need_const(0)
{}
~TMP_TABLE_PARAM()
{
--- 1.424/sql/sql_select.cc Thu Jul 28 13:34:43 2005
+++ 1.425/sql/sql_select.cc Thu Jul 28 18:16:46 2005
@@ -5201,7 +5201,8 @@
param->using_indirect_summary_function=1;
continue;
}
- if (item->const_item() && (int) hidden_field_count <= 0)
+ if (item->const_item() && (int) hidden_field_count <= 0 &&
+ !param->need_const)
continue; // We don't have to store this
}
if (type == Item::SUM_FUNC_ITEM && !group && !save_sum_fields)
--- 1.37/mysql-test/r/func_gconcat.result Tue Jul 26 00:51:17 2005
+++ 1.38/mysql-test/r/func_gconcat.result Thu Jul 28 19:10:32 2005
@@ -517,3 +517,34 @@
2 3,7
NULL 1,2,3,4,7
drop table t1;
+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;
+COUNT(*) GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
+2 test
+INSERT INTO t2 SET somename = 'test2';
+SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
+FROM t1 JOIN t2 ON t1.bID = t2.bID;
+COUNT(*) GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
+2 test
+DELETE FROM t2 WHERE somename = 'test2';
+SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
+FROM t1 JOIN t2 ON t1.bID = t2.bID;
+COUNT(*) GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
+2 test
+DROP TABLE t1,t2;
--- 1.29/mysql-test/t/func_gconcat.test Wed Jul 27 17:21:42 2005
+++ 1.30/mysql-test/t/func_gconcat.test Thu Jul 28 19:09:59 2005
@@ -310,4 +310,37 @@
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
| Thread |
|---|
| • bk commit into 4.1 tree (igor:1.2359) BUG#12095 | igor | 29 Jul |