mariadb/mysql-test/r/rpl_session_var.result
unknown d27bf14ed7 Bug #29878 Garbage data generation when executing SESSION_USER() on a slave.
Item_func_user doesn't calculate anything in it's val_str() method,
just returns saved str_value.
Though Item::save_in_field method can destroy str_value, relying on
val_str() return. As a result we get the garbage stored in field.

We cannot use Item::save_in_field implementation for Item_func_user,
reimplement it in simpler way.


mysql-test/r/rpl_session_var.result:
  Bug #29878 Garbage data generation when executing SESSION_USER() on a slave.
  
  test result
mysql-test/t/rpl_session_var.test:
  Bug #29878 Garbage data generation when executing SESSION_USER() on a slave.
  
  test case
sql/item.cc:
  Bug #29878 Garbage data generation when executing SESSION_USER() on a slave.
  
  duplicating code moved to Item::save_str_in_field
sql/item.h:
  Bug #29878 Garbage data generation when executing SESSION_USER() on a slave.
  
  duplicating code moved to Item::save_str_in_field
sql/item_strfunc.h:
  Bug #29878 Garbage data generation when executing SESSION_USER() on a slave.
  
  Item_func_user::save_in_field implemented as simple storing str_value
2007-07-27 18:42:25 +05:00

53 lines
1.3 KiB
Text

stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
create table t1(a varchar(100),b int);
set @@session.sql_mode=pipes_as_concat;
insert into t1 values('My'||'SQL', 1);
set @@session.sql_mode=default;
insert into t1 values('1'||'2', 2);
select * from t1 where b<3 order by a;
a b
1 2
MySQL 1
select * from t1 where b<3 order by a;
a b
1 2
MySQL 1
set @@session.sql_mode=ignore_space;
insert into t1 values(password ('MySQL'), 3);
set @@session.sql_mode=ansi_quotes;
create table "t2" ("a" int);
drop table t1, t2;
set @@session.sql_mode=default;
create table t1(a int auto_increment primary key);
create table t2(b int, a int);
set @@session.sql_auto_is_null=1;
insert into t1 values(null);
insert into t2 select 1,a from t1 where a is null;
set @@session.sql_auto_is_null=0;
insert into t1 values(null);
insert into t2 select 2,a from t1 where a is null;
select * from t2 order by b;
b a
1 1
select * from t2 order by b;
b a
1 1
drop table t1,t2;
CREATE TABLE t1 (
`id` int(11) NOT NULL auto_increment,
`data` varchar(100),
PRIMARY KEY (`id`)
) ENGINE=MyISAM;
INSERT INTO t1(data) VALUES(SESSION_USER());
SELECT * FROM t1;
id data
1
drop table t1;