Commit 581d4d23 authored by unknown's avatar unknown
Browse files

Bug#19599 duplication of information_schema column value in a CONCAT expr with user var

mark result string using String::mark_as_const()
which prevents CONCAT from reusing it as a buffer
for concatenation result.


mysql-test/r/information_schema.result:
  Bug#19599 duplication of information_schema column value in a CONCAT expr with user var
  test case
mysql-test/t/information_schema.test:
  Bug#19599 duplication of information_schema column value in a CONCAT expr with user var
  test case
parent 6c431a5e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1121,3 +1121,12 @@ NULL test v2 select 1 AS `1` NONE NO mysqltest_1@localhost DEFINER
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;
+10 −0
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -674,6 +674,7 @@ class Item_func_conv_charset :public Item_str_func
                                 str->charset(), conv_charset, &errors))
        null_value= 1;
      use_cached_value= 1;
      str_value.mark_as_const();
      safe= (errors == 0);
    }
    else