mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / suite / binlog / t / binlog_sf.test
blob05b31afcb58050718aab313ccfa66f683efed904
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"
10 # save status
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;
23 delimiter |;
24 --error ER_BINLOG_UNSAFE_ROUTINE
25 create function fn16456()
26        returns int
27 begin
28        return unix_timestamp();
29 end|
30 delimiter ;|
34 # force in definition, so we can see whether we fail on call
36 set global log_bin_trust_function_creators=1;
38 delimiter |;
39 create function fn16456()
40        returns int
41 begin
42        return unix_timestamp();
43 end|
44 delimiter ;|
46 set global log_bin_trust_function_creators=0;
50 # allow funcall in RBR
52 set binlog_format=ROW;
54 --replace_column 1 timestamp
55 select fn16456();
59 # fail funcall in SBR
61 set binlog_format=STATEMENT;
63 --error ER_BINLOG_UNSAFE_ROUTINE
64 select fn16456();
68 # clean
70 drop function fn16456;
74 # success in definition with deterministic
76 set global log_bin_trust_function_creators=0;
78 delimiter |;
79 create function fn16456()
80        returns int deterministic
81 begin
82        return unix_timestamp();
83 end|
84 delimiter ;|
88 # allow funcall in RBR
90 set binlog_format=ROW;
92 --replace_column 1 timestamp
93 select fn16456();
97 # allow funcall in SBR
99 set binlog_format=STATEMENT;
101 --replace_column 1 timestamp
102 select fn16456();
106 # clean
108 drop function fn16456;
111 # success in definition with NO SQL
113 set global log_bin_trust_function_creators=0;
115 delimiter |;
116 create function fn16456()
117        returns int no sql
118 begin
119        return unix_timestamp();
120 end|
121 delimiter ;|
125 # allow funcall in RBR
127 set binlog_format=ROW;
129 --replace_column 1 timestamp
130 select fn16456();
134 # allow funcall in SBR
136 set binlog_format=STATEMENT;
138 --replace_column 1 timestamp
139 select fn16456();
142 # clean
144 drop function fn16456;
148 # success in definition with reads sql data
150 set global log_bin_trust_function_creators=0;
152 delimiter |;
153 create function fn16456()
154        returns int reads sql data
155 begin
156        return unix_timestamp();
157 end|
158 delimiter ;|
162 # allow funcall in RBR
164 set binlog_format=ROW;
166 --replace_column 1 timestamp
167 select fn16456();
171 # allow funcall in SBR
173 set binlog_format=STATEMENT;
175 --replace_column 1 timestamp
176 select fn16456();
180 # clean
182 drop function fn16456;
186 # restore status
188 --disable_query_log
189 eval set binlog_format=$oblf;
190 eval set global log_bin_trust_function_creators=$otfc;
191 --enable_query_log