Skip to content

Commit b3dc9f6

Browse files
author
ram@gw.mysql.r18.ru
committed
A fix (bug #5540: CONCAT function and 'double' type).
1 parent 1dd895d commit b3dc9f6

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

mysql-test/r/func_concat.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ FROM t1 GROUP BY new LIMIT 1;
2626
number alpha new
2727
1413006 idlfmv 1413006<------------------>idlfmv
2828
drop table t1;
29+
create table t1 (a char(4), b double, c date, d tinyint(4));
30+
insert into t1 values ('AAAA', 105, '2003-03-01', 1);
31+
select * from t1 where concat(A,C,B,D) = 'AAAA2003-03-011051';
32+
a b c d
33+
AAAA 105 2003-03-01 1
34+
drop table t1;

mysql-test/t/func_concat.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,12 @@ FROM t1 GROUP BY new LIMIT 1;
2525
SELECT number, alpha, CONCAT_WS('<------------------>',number,alpha) AS new
2626
FROM t1 GROUP BY new LIMIT 1;
2727
drop table t1;
28+
29+
#
30+
# Bug #5540: a problem with double type
31+
#
32+
33+
create table t1 (a char(4), b double, c date, d tinyint(4));
34+
insert into t1 values ('AAAA', 105, '2003-03-01', 1);
35+
select * from t1 where concat(A,C,B,D) = 'AAAA2003-03-011051';
36+
drop table t1;

sql/item_strfunc.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ String *Item_func_concat::val_str(String *str)
289289
str->copy(*res);
290290
str->append(*res2);
291291
}
292-
res=str;
292+
res= str;
293+
use_as_buff= &tmp_value;
293294
}
294295
else if (res == &tmp_value)
295296
{

0 commit comments

Comments
 (0)