~drizzle-trunk/drizzle/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
-- source include/have_log_bin.inc

# Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR

# save status

let $oblf=`select @@SESSION.BINLOG_FORMAT`;
let $otfc=`select @@log_bin_trust_function_creators`;

set global log_bin_trust_function_creators=0;



# fail *on definition*

set binlog_format=STATEMENT;

delimiter |;
--error ER_BINLOG_UNSAFE_ROUTINE
create function fn16456()
       returns int
begin
       return unix_timestamp();
end|
delimiter ;|



# force in definition, so we can see whether we fail on call

set global log_bin_trust_function_creators=1;

delimiter |;
create function fn16456()
       returns int
begin
       return unix_timestamp();
end|
delimiter ;|

set global log_bin_trust_function_creators=0;



# allow funcall in RBR

set binlog_format=ROW;

--replace_column 1 timestamp
select fn16456();



# fail funcall in SBR

set binlog_format=STATEMENT;

--error ER_BINLOG_ROW_RBR_TO_SBR
select fn16456();



# restore status

drop function fn16456;

--disable_query_log
eval set binlog_format=$oblf;
eval set global log_bin_trust_function_creators=$otfc;
--enable_query_log