2007-06-07 19:20:49 +02:00
|
|
|
-- source include/have_log_bin.inc
|
|
|
|
|
2006-11-17 21:30:28 +01:00
|
|
|
# Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
|
2009-07-28 18:44:38 +01:00
|
|
|
# BUG#41166 stored function requires "deterministic" if binlog_format is "statement"
|
2006-11-17 21:30:28 +01:00
|
|
|
|
|
|
|
# save status
|
|
|
|
|
|
|
|
let $oblf=`select @@SESSION.BINLOG_FORMAT`;
|
|
|
|
let $otfc=`select @@log_bin_trust_function_creators`;
|
|
|
|
|
|
|
|
set global log_bin_trust_function_creators=0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# fail *on definition*
|
|
|
|
|
|
|
|
set binlog_format=STATEMENT;
|
|
|
|
|
|
|
|
delimiter |;
|
|
|
|
--error ER_BINLOG_UNSAFE_ROUTINE
|
|
|
|
create function fn16456()
|
|
|
|
returns int
|
|
|
|
begin
|
|
|
|
return unix_timestamp();
|
|
|
|
end|
|
|
|
|
delimiter ;|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# force in definition, so we can see whether we fail on call
|
|
|
|
|
|
|
|
set global log_bin_trust_function_creators=1;
|
|
|
|
|
|
|
|
delimiter |;
|
|
|
|
create function fn16456()
|
|
|
|
returns int
|
|
|
|
begin
|
|
|
|
return unix_timestamp();
|
|
|
|
end|
|
|
|
|
delimiter ;|
|
|
|
|
|
|
|
|
set global log_bin_trust_function_creators=0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# allow funcall in RBR
|
|
|
|
|
|
|
|
set binlog_format=ROW;
|
|
|
|
|
|
|
|
--replace_column 1 timestamp
|
|
|
|
select fn16456();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# fail funcall in SBR
|
|
|
|
|
|
|
|
set binlog_format=STATEMENT;
|
|
|
|
|
2009-07-28 18:44:38 +01:00
|
|
|
--error ER_BINLOG_UNSAFE_ROUTINE
|
2006-11-17 21:30:28 +01:00
|
|
|
select fn16456();
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-28 18:44:38 +01:00
|
|
|
# clean
|
|
|
|
|
|
|
|
drop function fn16456;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# success in definition with deterministic
|
|
|
|
|
|
|
|
set global log_bin_trust_function_creators=0;
|
|
|
|
|
|
|
|
delimiter |;
|
|
|
|
create function fn16456()
|
|
|
|
returns int deterministic
|
|
|
|
begin
|
|
|
|
return unix_timestamp();
|
|
|
|
end|
|
|
|
|
delimiter ;|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# allow funcall in RBR
|
|
|
|
|
|
|
|
set binlog_format=ROW;
|
|
|
|
|
|
|
|
--replace_column 1 timestamp
|
|
|
|
select fn16456();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# allow funcall in SBR
|
|
|
|
|
|
|
|
set binlog_format=STATEMENT;
|
|
|
|
|
|
|
|
--replace_column 1 timestamp
|
|
|
|
select fn16456();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# clean
|
|
|
|
|
|
|
|
drop function fn16456;
|
|
|
|
|
|
|
|
|
|
|
|
# success in definition with NO SQL
|
|
|
|
|
|
|
|
set global log_bin_trust_function_creators=0;
|
|
|
|
|
|
|
|
delimiter |;
|
|
|
|
create function fn16456()
|
|
|
|
returns int no sql
|
|
|
|
begin
|
|
|
|
return unix_timestamp();
|
|
|
|
end|
|
|
|
|
delimiter ;|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# allow funcall in RBR
|
|
|
|
|
|
|
|
set binlog_format=ROW;
|
|
|
|
|
|
|
|
--replace_column 1 timestamp
|
|
|
|
select fn16456();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# allow funcall in SBR
|
|
|
|
|
|
|
|
set binlog_format=STATEMENT;
|
|
|
|
|
|
|
|
--replace_column 1 timestamp
|
|
|
|
select fn16456();
|
|
|
|
|
|
|
|
|
|
|
|
# clean
|
2006-11-17 21:30:28 +01:00
|
|
|
|
|
|
|
drop function fn16456;
|
|
|
|
|
2009-07-28 18:44:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
# success in definition with reads sql data
|
|
|
|
|
|
|
|
set global log_bin_trust_function_creators=0;
|
|
|
|
|
|
|
|
delimiter |;
|
|
|
|
create function fn16456()
|
|
|
|
returns int reads sql data
|
|
|
|
begin
|
|
|
|
return unix_timestamp();
|
|
|
|
end|
|
|
|
|
delimiter ;|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# allow funcall in RBR
|
|
|
|
|
|
|
|
set binlog_format=ROW;
|
|
|
|
|
|
|
|
--replace_column 1 timestamp
|
|
|
|
select fn16456();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# allow funcall in SBR
|
|
|
|
|
|
|
|
set binlog_format=STATEMENT;
|
|
|
|
|
|
|
|
--replace_column 1 timestamp
|
|
|
|
select fn16456();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# clean
|
|
|
|
|
|
|
|
drop function fn16456;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# restore status
|
|
|
|
|
2006-11-17 21:30:28 +01:00
|
|
|
--disable_query_log
|
|
|
|
eval set binlog_format=$oblf;
|
|
|
|
eval set global log_bin_trust_function_creators=$otfc;
|
|
|
|
--enable_query_log
|