1 -- source include/have_log_bin.inc
3 # We change binlog format inside the test, so no need to re-run with
4 # more than one binlog_format.
5 -- source include/have_binlog_format_statement.inc
7 # Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
8 # BUG#41166 stored function requires "deterministic" if binlog_format is "statement"
12 let $oblf=`select @@SESSION.BINLOG_FORMAT`;
13 let $otfc=`select @@log_bin_trust_function_creators`;
15 set global log_bin_trust_function_creators=0;
19 # fail *on definition*
21 set binlog_format=STATEMENT;
24 --error ER_BINLOG_UNSAFE_ROUTINE
25 create function fn16456()
28 return unix_timestamp();
34 # force in definition, so we can see whether we fail on call
36 set global log_bin_trust_function_creators=1;
39 create function fn16456()
42 return unix_timestamp();
46 set global log_bin_trust_function_creators=0;
50 # allow funcall in RBR
52 set binlog_format=ROW;
54 --replace_column 1 timestamp
61 set binlog_format=STATEMENT;
63 --error ER_BINLOG_UNSAFE_ROUTINE
70 drop function fn16456;
74 # success in definition with deterministic
76 set global log_bin_trust_function_creators=0;
79 create function fn16456()
80 returns int deterministic
82 return unix_timestamp();
88 # allow funcall in RBR
90 set binlog_format=ROW;
92 --replace_column 1 timestamp
97 # allow funcall in SBR
99 set binlog_format=STATEMENT;
101 --replace_column 1 timestamp
108 drop function fn16456;
111 # success in definition with NO SQL
113 set global log_bin_trust_function_creators=0;
116 create function fn16456()
119 return unix_timestamp();
125 # allow funcall in RBR
127 set binlog_format=ROW;
129 --replace_column 1 timestamp
134 # allow funcall in SBR
136 set binlog_format=STATEMENT;
138 --replace_column 1 timestamp
144 drop function fn16456;
148 # success in definition with reads sql data
150 set global log_bin_trust_function_creators=0;
153 create function fn16456()
154 returns int reads sql data
156 return unix_timestamp();
162 # allow funcall in RBR
164 set binlog_format=ROW;
166 --replace_column 1 timestamp
171 # allow funcall in SBR
173 set binlog_format=STATEMENT;
175 --replace_column 1 timestamp
182 drop function fn16456;
189 eval set binlog_format=$oblf;
190 eval set global log_bin_trust_function_creators=$otfc;