MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:gluh Date:May 29 2006 9:31am
Subject:bk commit into 5.0 tree (gluh:1.2152) BUG#19599
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of gluh. When gluh does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2152 06/05/29 14:31:13 gluh@stripped +3 -0
  Bug#19599 duplication of information_schema column value in a CONCAT expr with user var
  do not use item buffer for result value if item is const

  sql/item_strfunc.cc
    1.267 06/05/29 14:29:39 gluh@stripped +5 -1
    Bug#19599 duplication of information_schema column value in a CONCAT expr with user var
    do not use item buffer for result value if item is const

  mysql-test/t/information_schema.test
    1.81 06/05/29 14:29:39 gluh@stripped +10 -0
    Bug#19599 duplication of information_schema column value in a CONCAT expr with user var
    test case

  mysql-test/r/information_schema.result
    1.106 06/05/29 14:29:39 gluh@stripped +9 -0
    Bug#19599 duplication of information_schema column value in a CONCAT expr with user var
    test case

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	gluh
# Host:	eagle.intranet.mysql.r18.ru
# Root:	/home/gluh/MySQL/Bugs/5.0.19599

--- 1.266/sql/item_strfunc.cc	Fri May 12 12:15:11 2006
+++ 1.267/sql/item_strfunc.cc	Mon May 29 14:29:39 2006
@@ -288,10 +288,12 @@ String *Item_func_concat::val_str(String
   DBUG_ASSERT(fixed == 1);
   String *res,*res2,*use_as_buff;
   uint i;
+  bool res_is_const= FALSE;
 
   null_value=0;
   if (!(res=args[0]->val_str(str)))
     goto null;
+  res_is_const= args[0]->const_item();
   use_as_buff= &tmp_value;
   for (i=1 ; i < arg_count ; i++)
   {
@@ -299,6 +301,7 @@ String *Item_func_concat::val_str(String
     {
       if (!(res=args[i]->val_str(str)))
 	goto null;
+      res_is_const= args[i]->const_item();
     }
     else
     {
@@ -315,7 +318,8 @@ String *Item_func_concat::val_str(String
 			    current_thd->variables.max_allowed_packet);
 	goto null;
       }
-      if (res->alloced_length() >= res->length()+res2->length())
+      if (res->alloced_length() >= res->length()+res2->length() &&
+          !res_is_const)
       {						// Use old buffer
 	res->append(*res2);
       }

--- 1.105/mysql-test/r/information_schema.result	Tue May 23 12:45:19 2006
+++ 1.106/mysql-test/r/information_schema.result	Mon May 29 14:29:39 2006
@@ -1121,3 +1121,12 @@ NULL	test	v2	select 1 AS `1`	NONE	NO	mys
 drop view v1, v2;
 drop table t1;
 drop user mysqltest_1@localhost;
+set @a:= '.';
+create table t1(f1 char(5));
+create table t2(f1 char(5));
+select concat(@a, table_name), @a, table_name
+from information_schema.tables where table_schema = 'test';
+concat(@a, table_name)	@a	table_name
+.t1	.	t1
+.t2	.	t2
+drop table t1,t2;

--- 1.80/mysql-test/t/information_schema.test	Tue May 23 20:05:32 2006
+++ 1.81/mysql-test/t/information_schema.test	Mon May 29 14:29:39 2006
@@ -838,3 +838,13 @@ connection default;
 drop view v1, v2;
 drop table t1;
 drop user mysqltest_1@localhost;
+
+#
+# Bug#19599 duplication of information_schema column value in a CONCAT expr with user var
+#
+set @a:= '.';
+create table t1(f1 char(5));
+create table t2(f1 char(5));
+select concat(@a, table_name), @a, table_name
+from information_schema.tables where table_schema = 'test';
+drop table t1,t2;
Thread
bk commit into 5.0 tree (gluh:1.2152) BUG#19599gluh29 May