List:Commits« Previous MessageNext Message »
From:Sergey Glukhov Date:September 10 2009 10:55am
Subject:bzr push into mysql-pe branch (Sergey.Glukhov:3596 to 3597)
View as plain text  
 3597 Sergey Glukhov	2009-09-10 [merge]
      5.1-bugteam->mysql-pe merge
     @ mysql-test/r/func_str.result
        5.1-bugteam->mysql-pe merge
     @ mysql-test/t/func_str.test
        5.1-bugteam->mysql-pe merge
     @ sql/item_strfunc.cc
        5.1-bugteam->mysql-pe merge

    modified:
      mysql-test/r/func_str.result
      mysql-test/t/func_str.test
      sql/item_strfunc.cc
 3596 Li-Bing.Song@stripped	2009-09-10 [merge]
      Auto Merge

    modified:
      mysql-test/extra/rpl_tests/rpl_auto_increment.test
      mysql-test/suite/rpl/r/rpl_auto_increment.result
      sql/log_event.cc
=== modified file 'mysql-test/r/func_str.result'
--- a/mysql-test/r/func_str.result	2009-07-31 17:53:36 +0000
+++ b/mysql-test/r/func_str.result	2009-09-10 10:52:10 +0000
@@ -2537,6 +2537,15 @@ SELECT LOAD_FILE(a) FROM t1;
 LOAD_FILE(a)
 NULL
 DROP TABLE t1;
+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;
+concat_name
+LOAD_MIN
+LOAD_MAX
+DROP TABLE t1, t2;
 End of 5.0 tests
 drop table if exists t1;
 create table t1(f1 tinyint default null)engine=myisam;

=== modified file 'mysql-test/t/func_str.test'
--- a/mysql-test/t/func_str.test	2009-07-02 08:19:17 +0000
+++ b/mysql-test/t/func_str.test	2009-09-10 10:52:10 +0000
@@ -1291,6 +1291,19 @@ 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
 

=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	2009-07-06 08:38:21 +0000
+++ b/sql/item_strfunc.cc	2009-09-10 10:52:10 +0000
@@ -775,6 +775,7 @@ String *Item_func_concat_ws::val_str(Str
   String tmp_sep_str(tmp_str_buff, sizeof(tmp_str_buff),default_charset_info),
          *sep_str, *res, *res2,*use_as_buff;
   uint i;
+  bool is_const= 0;
 
   null_value=0;
   if (!(sep_str= args[0]->val_str(&tmp_sep_str)))
@@ -788,7 +789,11 @@ String *Item_func_concat_ws::val_str(Str
   // If not, return the empty string
   for (i=1; i < arg_count; i++)
     if ((res= args[i]->val_str(str)))
+    {
+      is_const= args[i]->const_item() || !args[i]->used_tables();
       break;
+    }
+
   if (i ==  arg_count)
     return &my_empty_string;
 
@@ -806,7 +811,7 @@ String *Item_func_concat_ws::val_str(Str
 			  current_thd->variables.max_allowed_packet);
       goto null;
     }
-    if (res->alloced_length() >=
+    if (!is_const && res->alloced_length() >=
 	res->length() + sep_str->length() + res2->length())
     {						// Use old buffer
       res->append(*sep_str);			// res->length() > 0 always


Attachment: [text/bzr-bundle] bzr/sergey.glukhov@sun.com-20090910105210-phwkvbmxtdppzpmz.bundle
Thread
bzr push into mysql-pe branch (Sergey.Glukhov:3596 to 3597)Sergey Glukhov10 Sep