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