Commit bb944aa9 authored by igor@rurik.mysql.com's avatar igor@rurik.mysql.com

Merge rurik.mysql.com:/home/igor/mysql-4.1

into rurik.mysql.com:/home/igor/dev/mysql-4.1-1
parents 28214f3d 2104e9e6
......@@ -741,3 +741,13 @@ SELECT dt DIV 1 AS f, id FROM t1 GROUP BY f;
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;
......@@ -565,3 +565,18 @@ INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' );
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;
......@@ -51,8 +51,8 @@ bool Item_str_buff::cmp(void)
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))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment