Debian Codegraph @

mysql-test/suite/binlog/t/binlog_sf.test

raw
1
2 # We change binlog format inside the test, so no need to re-run with
3 # more than one binlog_format.
4 -- source include/have_binlog_format_statement.inc
5
6 # Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
7 # BUG#41166 stored function requires "deterministic" if binlog_format is "statement"
8
9 # save status
10
11 let $otfc=`select @@log_bin_trust_function_creators`;
12 set global log_bin_trust_function_creators=0;
13
14 # fail *on definition*
15
16 set binlog_format=STATEMENT;
17
18 delimiter |;
19 --error ER_BINLOG_UNSAFE_ROUTINE
20 create function fn16456()
21 returns int
22 begin
23 return unix_timestamp();
24 end|
25 delimiter ;|
26
27
28
29 # force in definition, so we can see whether we fail on call
30
31 set global log_bin_trust_function_creators=1;
32
33 delimiter |;
34 create function fn16456()
35 returns int
36 begin
37 return unix_timestamp();
38 end|
39 delimiter ;|
40
41 set global log_bin_trust_function_creators=0;
42
43
44
45 # allow funcall in RBR
46
47 set binlog_format=ROW;
48
49 --replace_column 1 timestamp
50 select fn16456();
51
52
53
54 # fail funcall in SBR
55
56 set binlog_format=STATEMENT;
57
58 --error ER_BINLOG_UNSAFE_ROUTINE
59 select fn16456();
60
61
62
63 # clean
64
65 drop function fn16456;
66
67
68
69 # success in definition with deterministic
70
71 set global log_bin_trust_function_creators=0;
72
73 delimiter |;
74 create function fn16456()
75 returns int deterministic
76 begin
77 return unix_timestamp();
78 end|
79 delimiter ;|
80
81
82
83 # allow funcall in RBR
84
85 set binlog_format=ROW;
86
87 --replace_column 1 timestamp
88 select fn16456();
89
90
91
92 # allow funcall in SBR
93
94 set binlog_format=STATEMENT;
95
96 --replace_column 1 timestamp
97 select fn16456();
98
99
100
101 # clean
102
103 drop function fn16456;
104
105
106 # success in definition with NO SQL
107
108 set global log_bin_trust_function_creators=0;
109
110 delimiter |;
111 create function fn16456()
112 returns int no sql
113 begin
114 return unix_timestamp();
115 end|
116 delimiter ;|
117
118
119
120 # allow funcall in RBR
121
122 set binlog_format=ROW;
123
124 --replace_column 1 timestamp
125 select fn16456();
126
127
128
129 # allow funcall in SBR
130
131 set binlog_format=STATEMENT;
132
133 --replace_column 1 timestamp
134 select fn16456();
135
136
137 # clean
138
139 drop function fn16456;
140
141
142
143 # success in definition with reads sql data
144
145 set global log_bin_trust_function_creators=0;
146
147 delimiter |;
148 create function fn16456()
149 returns int reads sql data
150 begin
151 return unix_timestamp();
152 end|
153 delimiter ;|
154
155
156
157 # allow funcall in RBR
158
159 set binlog_format=ROW;
160
161 --replace_column 1 timestamp
162 select fn16456();
163
164
165
166 # allow funcall in SBR
167
168 set binlog_format=STATEMENT;
169
170 --replace_column 1 timestamp
171 select fn16456();
172
173
174
175 # clean
176
177 drop function fn16456;
178
179
180
181 # restore status
182
183 --disable_query_log
184 set binlog_format=STATEMENT;
185 eval set global log_bin_trust_function_creators=$otfc;
186 reset master;
187 --enable_query_log