From: Date: June 21 2005 1:24pm Subject: bk commit into 4.1 tree (igor:1.2303) BUG#11088 List-Archive: http://lists.mysql.com/internals/26234 X-Bug: 11088 Message-Id: <20050621112429.2474C1679B7@rurik.mysql.com> 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.2303 05/06/21 04:24:21 igor@stripped +3 -0 group_by.result, group_by.test: Added a test case for bug #11295. item_buff.cc: Fixed bug #11295. This a correction for the patch of bug #11088 that takes into account a possible NULL values of the BLOB column. mysql-test/r/group_by.result 1.49 05/06/21 04:21:51 igor@stripped +10 -0 Added a test case for bug #11295. mysql-test/t/group_by.test 1.39 05/06/21 04:21:19 igor@stripped +15 -0 Added a test case for bug #11295. sql/item_buff.cc 1.11 05/06/21 04:17:42 igor@stripped +2 -2 Fixed bug #11295. This a correction for the patch of bug #11088 that takes into account a possible NULL values of the BLOB column. # 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-1 --- 1.10/sql/item_buff.cc Tue Jun 7 04:20:43 2005 +++ 1.11/sql/item_buff.cc Tue Jun 21 04:17:42 2005 @@ -51,8 +51,8 @@ String *res; bool tmp; - res=item->val_str(&tmp_value); - res->length(min(res->length(), value.alloced_length())); + if ((res=item->val_str(&tmp_value))) + res->length(min(res->length(), value.alloced_length())); if (null_value != item->null_value) { if ((null_value= item->null_value)) --- 1.48/mysql-test/r/group_by.result Mon Jun 20 10:47:24 2005 +++ 1.49/mysql-test/r/group_by.result Tue Jun 21 04:21:51 2005 @@ -741,3 +741,13 @@ f id 20050501123000 1 DROP TABLE t1; +CREATE TABLE t1 (id varchar(20) NOT NULL); +INSERT INTO t1 VALUES ('trans1'), ('trans2'); +CREATE TABLE t2 (id varchar(20) NOT NULL, err_comment blob NOT NULL); +INSERT INTO t2 VALUES ('trans1', 'a problem'); +SELECT COUNT(DISTINCT(t1.id)), LEFT(err_comment, 256) AS err_comment +FROM t1 LEFT JOIN t2 ON t1.id=t2.id GROUP BY err_comment; +COUNT(DISTINCT(t1.id)) err_comment +1 NULL +1 a problem +DROP TABLE t1, t2; --- 1.38/mysql-test/t/group_by.test Mon Jun 20 10:46:33 2005 +++ 1.39/mysql-test/t/group_by.test Tue Jun 21 04:21:19 2005 @@ -565,3 +565,18 @@ SELECT dt DIV 1 AS f, id FROM t1 GROUP BY f; DROP TABLE t1; + +# +# Test for bug #11295: GROUP BY a BLOB column with COUNT(DISTINCT column1) +# when the BLOB column takes NULL values +# + +CREATE TABLE t1 (id varchar(20) NOT NULL); +INSERT INTO t1 VALUES ('trans1'), ('trans2'); +CREATE TABLE t2 (id varchar(20) NOT NULL, err_comment blob NOT NULL); +INSERT INTO t2 VALUES ('trans1', 'a problem'); + +SELECT COUNT(DISTINCT(t1.id)), LEFT(err_comment, 256) AS err_comment + FROM t1 LEFT JOIN t2 ON t1.id=t2.id GROUP BY err_comment; + +DROP TABLE t1, t2;