1
drop table if exists t1;
2
'#--------------------FN_DYNVARS_063_01-------------------------#'
3
## Creating new user tt ##
4
CREATE user tt@localhost;
5
## Setting value of variable to 0 ##
6
SET @@global.log_bin_trust_function_creators = 0;
7
## Creating new table t2 ##
8
create table t2 (a INT);
9
## Creating & connecting with new connection test_con1 ##
10
SELECT @@log_bin_trust_function_creators;
11
@@log_bin_trust_function_creators
13
## Creating new function f1 fails because no DETERMINISTIC ###
14
CREATE FUNCTION f1(a INT) RETURNS INT
17
INSERT INTO t2 VALUES (a);
21
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)
22
## Creating new function f1 fails because non-super user ##
23
CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC
26
INSERT INTO t2 VALUES (a);
30
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)
31
## Creating new function f1 succeeds ##
32
CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC
35
INSERT INTO t2 VALUES (a);
39
## Creating new table t1 ##
40
CREATE TABLE t1 (a INT);
41
## Inserting some records in t1 ##
42
INSERT INTO t1 VALUES (1),(2),(3);
48
## Dropping function f1 & table t1 ##
51
'#--------------------FN_DYNVARS_063_02-------------------------#'
52
## Switching to default connection ##
53
## Setting value of variable to 1 ##
54
SET @@global.log_bin_trust_function_creators = 1;
55
## Creating and connecting to new connection test_con2 ##
56
## Verifying value of variable ##
57
SELECT @@log_bin_trust_function_creators;
58
@@log_bin_trust_function_creators
63
## Creating new function f1 ##
64
CREATE FUNCTION f1(a INT) RETURNS INT
67
INSERT INTO t2 VALUES (a);
71
## Creating new table t1 ##
72
CREATE TABLE t1 (a INT);
73
## Inserting values in table t1 ##
74
INSERT INTO t1 VALUES (1),(2),(3);
80
## Dropping function f1 ##
82
## Dropping table t1 & t2 ##
84
## Disconnecting both the connections ##