Debian Codegraph @

mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_func.result

raw
1 drop table if exists t1;
2 '#--------------------FN_DYNVARS_063_01-------------------------#'
3 SET @start_value= @@global.log_bin_trust_function_creators;
4 ## Creating new user tt ##
5 CREATE USER tt@localhost;
6 GRANT ALL ON test.* TO tt@localhost;
7 ## Setting value of variable to 0 ##
8 SET @@global.log_bin_trust_function_creators = 0;
9 ## Creating new table t2 ##
10 CREATE TABLE t2 (a INT);
11 connect test_con1,localhost,tt,,;
12 connection test_con1;
13 SELECT @@log_bin_trust_function_creators;
14 @@log_bin_trust_function_creators
15 0
16 ## Creating new function f1 fails because no DETERMINISTIC ###
17 CREATE FUNCTION f1(a INT) RETURNS INT
18 BEGIN
19 IF (a < 3) THEN
20 INSERT INTO t2 VALUES (a);
21 END IF;
22 RETURN 1;
23 END|
24 ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
25 ## Creating new function f1 fails because non-super user ##
26 CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC
27 BEGIN
28 IF (a < 3) THEN
29 INSERT INTO t2 VALUES (a);
30 END IF;
31 RETURN 1;
32 END|
33 ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
34 connection default;
35 ## Creating new function f1 succeeds ##
36 CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC
37 BEGIN
38 IF (a < 3) THEN
39 INSERT INTO t2 VALUES (a);
40 END IF;
41 RETURN 1;
42 END|
43 ## Creating new table t1 ##
44 CREATE TABLE t1 (a INT);
45 ## Inserting some records in t1 ##
46 INSERT INTO t1 VALUES (1),(2),(3);
47 SELECT f1(a) FROM t1;
48 f1(a)
49 1
50 1
51 1
52 ## Dropping function f1 & table t1 ##
53 DROP FUNCTION f1;
54 DROP TABLE t1;
55 '#--------------------FN_DYNVARS_063_02-------------------------#'
56 connection default;
57 ## Setting value of variable to 1 ##
58 SET @@global.log_bin_trust_function_creators = 1;
59 connect test_con2,localhost,tt,,;
60 connection test_con2;
61 ## Verifying value of variable ##
62 SELECT @@log_bin_trust_function_creators;
63 @@log_bin_trust_function_creators
64 1
65 SELECT @@sql_log_bin;
66 @@sql_log_bin
67 1
68 ## Creating new function f1 ##
69 CREATE FUNCTION f1(a INT) RETURNS INT
70 BEGIN
71 IF (a < 3) THEN
72 INSERT INTO t2 VALUES (a);
73 END IF;
74 RETURN 1;
75 END|
76 ## Creating new table t1 ##
77 CREATE TABLE t1 (a INT);
78 ## Inserting values in table t1 ##
79 INSERT INTO t1 VALUES (1),(2),(3);
80 SELECT f1(a) FROM t1;
81 f1(a)
82 1
83 1
84 1
85 ## Dropping function f1 ##
86 DROP FUNCTION f1;
87 ## Dropping table t1 & t2 ##
88 DROP TABLE t1,t2;
89 disconnect test_con2;
90 connection default;
91 DROP USER tt@localhost;
92 SET @@global.log_bin_trust_function_creators= @start_value;