1
0
mirror of https://github.com/MariaDB/server.git synced 2025-06-01 19:42:01 +03:00
mariadb/mysql-test/r/log_bin_trust_function_creators_func.result
Andrei Elkin d083ceabe8 Bug #41003 log_bin_trust_function_creators_func test explicitly warns on a bug in it
The test 
1. did not verify that CREATE FUNCTION shall fails in a case of active binlog
   and @@log_bin_trust_function_creators is zero if there is no DETERMINISTIC qualifier
   and super user privilege;
2. contained an explit warning on that CREATE FUNCTION actually succeeded whereas
   it was supposed to fail;
3. did not demand the bin-log be set ON even though it has contained the opt file
   explictily setting the name for the binlog file.
      
Fixed 1-3 with modifying the test accordingly.
2008-12-12 21:15:56 +02:00

85 lines
2.3 KiB
Plaintext

drop table if exists t1;
'#--------------------FN_DYNVARS_063_01-------------------------#'
## Creating new user tt ##
CREATE user tt@localhost;
## Setting value of variable to 0 ##
SET @@global.log_bin_trust_function_creators = 0;
## Creating new table t2 ##
create table t2 (a INT);
## Creating & connecting with new connection test_con1 ##
SELECT @@log_bin_trust_function_creators;
@@log_bin_trust_function_creators
0
## Creating new function f1 fails because no DETERMINISTIC ###
CREATE FUNCTION f1(a INT) RETURNS INT
BEGIN
IF (a < 3) THEN
INSERT INTO t2 VALUES (a);
END IF;
RETURN 1;
END|
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)
## Creating new function f1 fails because non-super user ##
CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC
BEGIN
IF (a < 3) THEN
INSERT INTO t2 VALUES (a);
END IF;
RETURN 1;
END|
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)
## Creating new function f1 succeeds ##
CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC
BEGIN
IF (a < 3) THEN
INSERT INTO t2 VALUES (a);
END IF;
RETURN 1;
END|
## Creating new table t1 ##
CREATE TABLE t1 (a INT);
## Inserting some records in t1 ##
INSERT INTO t1 VALUES (1),(2),(3);
SELECT f1(a) FROM t1;
f1(a)
1
1
1
## Dropping function f1 & table t1 ##
drop function f1;
drop table t1;
'#--------------------FN_DYNVARS_063_02-------------------------#'
## Switching to default connection ##
## Setting value of variable to 1 ##
SET @@global.log_bin_trust_function_creators = 1;
## Creating and connecting to new connection test_con2 ##
## Verifying value of variable ##
SELECT @@log_bin_trust_function_creators;
@@log_bin_trust_function_creators
1
SELECT @@sql_log_bin;
@@sql_log_bin
1
## Creating new function f1 ##
CREATE FUNCTION f1(a INT) RETURNS INT
BEGIN
IF (a < 3) THEN
INSERT INTO t2 VALUES (a);
END IF;
RETURN 1;
END|
## Creating new table t1 ##
CREATE TABLE t1 (a INT);
## Inserting values in table t1 ##
INSERT INTO t1 VALUES (1),(2),(3);
SELECT f1(a) FROM t1;
f1(a)
1
1
1
## Dropping function f1 ##
drop function f1;
## Dropping table t1 & t2 ##
drop table t1,t2;
## Disconnecting both the connections ##