From 5fbc2904bccbcd5e3609a4a660105ccab117c7c6 Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Thu, 10 Sep 2009 15:24:07 +0500 Subject: Bug#46815 CONCAT_WS returning wrong data The problem is that argument buffer can be used as result buffer and it leads to argument value change. The fix is to use 'old buffer' as result buffer only if first argument is not constant item. --- mysql-test/t/func_str.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mysql-test/t/func_str.test') diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 4b0f91e4408..e396fbcebd8 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1177,5 +1177,18 @@ INSERT INTO t1 VALUES ('aaaaaaaa'); SELECT LOAD_FILE(a) FROM t1; DROP TABLE t1; +# +# Bug#46815 CONCAT_WS returning wrong data +# +CREATE TABLE t1 (f2 VARCHAR(20)); +CREATE TABLE t2 (f2 VARCHAR(20)); + +INSERT INTO t1 VALUES ('MIN'),('MAX'); +INSERT INTO t2 VALUES ('LOAD'); + +SELECT CONCAT_WS('_', (SELECT t2.f2 FROM t2), t1.f2) AS concat_name FROM t1; + +DROP TABLE t1, t2; + --echo End of 5.0 tests -- cgit v1.2.1