1
-- source include/have_log_bin.inc
3
# Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
4
# BUG#41166 stored function requires "deterministic" if binlog_format is "statement"
8
let $oblf=`select @@SESSION.BINLOG_FORMAT`;
9
let $otfc=`select @@log_bin_trust_function_creators`;
11
set global log_bin_trust_function_creators=0;
15
# fail *on definition*
17
set binlog_format=STATEMENT;
20
--error ER_BINLOG_UNSAFE_ROUTINE
21
create function fn16456()
24
return unix_timestamp();
30
# force in definition, so we can see whether we fail on call
32
set global log_bin_trust_function_creators=1;
35
create function fn16456()
38
return unix_timestamp();
42
set global log_bin_trust_function_creators=0;
46
# allow funcall in RBR
48
set binlog_format=ROW;
50
--replace_column 1 timestamp
57
set binlog_format=STATEMENT;
59
--error ER_BINLOG_UNSAFE_ROUTINE
66
drop function fn16456;
70
# success in definition with deterministic
72
set global log_bin_trust_function_creators=0;
75
create function fn16456()
76
returns int deterministic
78
return unix_timestamp();
84
# allow funcall in RBR
86
set binlog_format=ROW;
88
--replace_column 1 timestamp
93
# allow funcall in SBR
95
set binlog_format=STATEMENT;
97
--replace_column 1 timestamp
104
drop function fn16456;
107
# success in definition with NO SQL
109
set global log_bin_trust_function_creators=0;
112
create function fn16456()
115
return unix_timestamp();
121
# allow funcall in RBR
123
set binlog_format=ROW;
125
--replace_column 1 timestamp
130
# allow funcall in SBR
132
set binlog_format=STATEMENT;
134
--replace_column 1 timestamp
140
drop function fn16456;
144
# success in definition with reads sql data
146
set global log_bin_trust_function_creators=0;
149
create function fn16456()
150
returns int reads sql data
152
return unix_timestamp();
158
# allow funcall in RBR
160
set binlog_format=ROW;
162
--replace_column 1 timestamp
167
# allow funcall in SBR
169
set binlog_format=STATEMENT;
171
--replace_column 1 timestamp
178
drop function fn16456;
185
eval set binlog_format=$oblf;
186
eval set global log_bin_trust_function_creators=$otfc;