Re: Bug in 4.0.20: CONCAT function and 'double' type
"Mikhail Entaltsev" <[email protected]> Mon, 13 Sep 2004 12:28:19 +0200
| Newsgroups | gmane.comp.db.mysql.bugs |
|---|---|
| Message-ID | <024c01c4997c$63c006e0$0e3ca8c0@rover14> |
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. ----- Original Message ----- From: "Mikhail Entaltsev" <[email protected]> To: <[email protected]> Sent: Tuesday, August 17, 2004 4:49 PM Subject: Bug in 4.0.20: CONCAT function and 'double' type > 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. > > > -- > MySQL Bugs Mailing List > For list archives: http://lists.mysql.com/bugs > To unsubscribe: http://lists.mysql.com/[email protected] > > -- MySQL Bugs Mailing List For list archives: http://lists.mysql.com/bugs To unsubscribe: http://lists.mysql.com/[email protected]