mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug#16084594 USER_VAR ITEM IN 'LOAD FILE QUERY' WAS NOT
PROPERLY QUOTED IN BINLOG FILE Problem: In load data file query, User variables are allowed inside "Into_list" and "Set_list". These user variables used inside these two lists are not properly guarded with backticks while server is writting into binlog. Hence user variable names like a` cannot be used in this context. Fix: Properly quote these variables while writting into binlog mysql-test/r/func_compress.result: changing result file mysql-test/r/variables.result: changing result file mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result: changing result file sql/item_func.cc: Quote the user variable items
This commit is contained in:
@ -11,7 +11,7 @@ explain extended select uncompress(compress(@test_compress_string));
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select uncompress(compress((@test_compress_string))) AS `uncompress(compress(@test_compress_string))`
|
Note 1003 select uncompress(compress((@`test_compress_string`))) AS `uncompress(compress(@test_compress_string))`
|
||||||
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
|
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
|
||||||
uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
|
uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
|
||||||
1
|
1
|
||||||
@ -19,7 +19,7 @@ explain extended select uncompressed_length(compress(@test_compress_string))=len
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select (uncompressed_length(compress((@test_compress_string))) = length((@test_compress_string))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
|
Note 1003 select (uncompressed_length(compress((@`test_compress_string`))) = length((@`test_compress_string`))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
|
||||||
select uncompressed_length(compress(@test_compress_string));
|
select uncompressed_length(compress(@test_compress_string));
|
||||||
uncompressed_length(compress(@test_compress_string))
|
uncompressed_length(compress(@test_compress_string))
|
||||||
117
|
117
|
||||||
|
@ -77,7 +77,7 @@ explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
|
|||||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@t1) AS `@t1`,(@t2) AS `@t2`,(@t3) AS `@t3`
|
Note 1003 select (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@`t1`) AS `@t1`,(@`t2`) AS `@t2`,(@`t3`) AS `@t3`
|
||||||
select @t5;
|
select @t5;
|
||||||
@t5
|
@t5
|
||||||
1.23456
|
1.23456
|
||||||
|
@ -631,7 +631,7 @@ master-bin.000001 # Query # # BEGIN
|
|||||||
master-bin.000001 # Intvar # # INSERT_ID=10
|
master-bin.000001 # Intvar # # INSERT_ID=10
|
||||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||||||
master-bin.000001 # Intvar # # INSERT_ID=10
|
master-bin.000001 # Intvar # # INSERT_ID=10
|
||||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @b) SET `b`=((@b) + `bug27417`(2)) ;file_id=#
|
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @`b`) SET `b`=((@`b`) + `bug27417`(2)) ;file_id=#
|
||||||
master-bin.000001 # Query # # ROLLBACK
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
/* the output must denote there is the query */;
|
/* the output must denote there is the query */;
|
||||||
drop trigger trg_del_t2;
|
drop trigger trg_del_t2;
|
||||||
@ -869,7 +869,7 @@ master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
|
|||||||
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
|
||||||
master-bin.000001 # Intvar # # INSERT_ID=10
|
master-bin.000001 # Intvar # # INSERT_ID=10
|
||||||
master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
|
master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
|
||||||
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @b) SET `b`=((@b) + `bug27417`(2)) ;file_id=#
|
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @`b`) SET `b`=((@`b`) + `bug27417`(2)) ;file_id=#
|
||||||
master-bin.000001 # Query # # ROLLBACK
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
drop trigger trg_del_t2;
|
drop trigger trg_del_t2;
|
||||||
drop table t1,t2,t3,t4,t5;
|
drop table t1,t2,t3,t4,t5;
|
||||||
|
@ -4725,7 +4725,7 @@ enum Item_result Item_func_get_user_var::result_type() const
|
|||||||
void Item_func_get_user_var::print(String *str, enum_query_type query_type)
|
void Item_func_get_user_var::print(String *str, enum_query_type query_type)
|
||||||
{
|
{
|
||||||
str->append(STRING_WITH_LEN("(@"));
|
str->append(STRING_WITH_LEN("(@"));
|
||||||
str->append(name.str,name.length);
|
append_identifier(current_thd, str, name.str, name.length);
|
||||||
str->append(')');
|
str->append(')');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4826,7 +4826,7 @@ my_decimal* Item_user_var_as_out_param::val_decimal(my_decimal *decimal_buffer)
|
|||||||
void Item_user_var_as_out_param::print(String *str, enum_query_type query_type)
|
void Item_user_var_as_out_param::print(String *str, enum_query_type query_type)
|
||||||
{
|
{
|
||||||
str->append('@');
|
str->append('@');
|
||||||
str->append(name.str,name.length);
|
append_identifier(current_thd, str, name.str, name.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user