1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fix for bug #9764 (DISTINCT IFNULL truncates data)

mysql-test/r/create.result:
  test result fixed
mysql-test/r/distinct.result:
  test result fixed
mysql-test/t/distinct.test:
  test case added
sql/item_cmpfunc.cc:
  max_length should be calculated differently for DECIMAL_RESULT and others
This commit is contained in:
unknown
2005-06-08 20:35:37 +05:00
parent e595b7ee9d
commit 2fded7d5c4
4 changed files with 29 additions and 15 deletions

View File

@ -434,7 +434,7 @@ d date YES NULL
e varchar(1) NO
f datetime YES NULL
g time YES NULL
h varbinary(23) NO
h longblob NO
dd time YES NULL
select * from t2;
a b c d e f g h dd

View File

@ -464,3 +464,11 @@ SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
html prod
1 0.0000
drop table t1;
create table t1 (id int, dsc varchar(50));
insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
select distinct id, IFNULL(dsc, '-') from t1;
id IFNULL(dsc, '-')
1 line number one
2 line number two
3 line number three
drop table t1;

View File

@ -332,3 +332,11 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES ('1',1,0);
SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
drop table t1;
#
# Bug 9784 DISTINCT IFNULL truncates data
#
create table t1 (id int, dsc varchar(50));
insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
select distinct id, IFNULL(dsc, '-') from t1;
drop table t1;