5 messages in com.mysql.lists.bugsRe: Bug in 4.0.20: CONCAT function an...
FromSent OnAttachments
Ing. Christian Groesswang07 Aug 2004 03:49 
Sergei Golubchik10 Aug 2004 05:57 
Mikhail Entaltsev17 Aug 2004 07:49 
Mikhail Entaltsev13 Sep 2004 03:27 
Sergei Golubchik13 Sep 2004 07:29 
Subject:Re: Bug in 4.0.20: CONCAT function and 'double' type
From:Mikhail Entaltsev (ment@cmt-trading.de)
Date:09/13/2004 03:27:57 AM
List:com.mysql.lists.bugs

Hi,

I have sent that email ~1 month ago but didn't see anything related to it on the mail-list. Just would like to be sure that someone from MySQL AB get it.

Thanks in advance, Mikhail.

Hi,

It seems like it is a bug in MySQL version 4.0.20-standard-log. Comparison between string and concat function returns wrong result. Look at short example:

CREATE TABLE `Tmp` ( `A` char(4) NOT NULL default '', `B` double default NULL, `C` date default NULL, `D` tinyint(4) default NULL ) TYPE=MyISAM;

insert into Tmp (A,B,C,D) values ('AAAA',105,'2003-03-01',1);

select * from Tmp where concat(A,C,B,D) = 'AAAA2003-03-011051'; # 0 records - BUG!!!

It returns 0 records and it is wrong! But if you will change fields order in the concat function it will work fine (it returns 1 record):

select * from Tmp where concat(A,B,C,D) = 'AAAA1052003-03-011';

# FALSE as comparison result - BUG!!! select concat(A,C,B,D),'AAAA2003-03-011051',(concat(A,C,B,D) = 'AAAA2003-03-011051') from Tmp; # TRUE as comparison result select concat(A,B,C,D),'AAAA1052003-03-011',(concat(A,B,C,D) = 'AAAA1052003-03-011') from Tmp; drop table Tmp;

But if you change type of the 'B' field from double to int everything is working fine:

CREATE TABLE `Tmp1` ( `A` char(4) NOT NULL default '', `B` int default NULL, `C` date default NULL, `D` tinyint(4) default NULL ) TYPE=MyISAM; insert into Tmp1 (A,B,C,D) values ('AAAA',105,'2003-03-01',1); select * from Tmp1 where concat(A,C,B,D) = 'AAAA2003-03-011051'; select * from Tmp1 where concat(A,B,C,D) = 'AAAA1052003-03-011'; select concat(A,C,B,D),'AAAA2003-03-011051',(concat(A,C,B,D) = 'AAAA2003-03-011051') from Tmp1; select concat(A,B,C,D),'AAAA1052003-03-011',(concat(A,B,C,D) = 'AAAA1052003-03-011') from Tmp1; drop table Tmp1;

Best regards, Mikhail.