mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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. mysql-test/r/log_bin_trust_function_creators_func.result: Bug #41003 changed results. mysql-test/t/log_bin_trust_function_creators_func-master.opt: removed unnecessary file, the specificly requested binlog file name was not used in the test. mysql-test/t/log_bin_trust_function_creators_func.test: corrected the test that previously: 1. did not verify that CREATE FUNCTION shall fail in some cases; 2. contained an explit warning on that CREATE FUNCTION actually
This commit is contained in:
@ -10,10 +10,7 @@ create table t2 (a INT);
|
||||
SELECT @@log_bin_trust_function_creators;
|
||||
@@log_bin_trust_function_creators
|
||||
0
|
||||
SELECT @@sql_log_bin;
|
||||
@@sql_log_bin
|
||||
1
|
||||
## Creating new function f1 ##
|
||||
## Creating new function f1 fails because no DETERMINISTIC ###
|
||||
CREATE FUNCTION f1(a INT) RETURNS INT
|
||||
BEGIN
|
||||
IF (a < 3) THEN
|
||||
@ -21,8 +18,24 @@ INSERT INTO t2 VALUES (a);
|
||||
END IF;
|
||||
RETURN 1;
|
||||
END|
|
||||
'Bug: Create Function should give error here because non-super user';
|
||||
'is creating function here';
|
||||
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 ##
|
||||
|
@ -1 +0,0 @@
|
||||
--log-bin=test.log
|
@ -20,6 +20,8 @@
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
source include/have_log_bin.inc;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
@ -45,10 +47,10 @@ connect (test_con1,localhost,tt,,);
|
||||
connection test_con1;
|
||||
|
||||
SELECT @@log_bin_trust_function_creators;
|
||||
SELECT @@sql_log_bin;
|
||||
|
||||
--echo ## Creating new function f1 ##
|
||||
--echo ## Creating new function f1 fails because no DETERMINISTIC ###
|
||||
delimiter |;
|
||||
--error ER_BINLOG_UNSAFE_ROUTINE
|
||||
CREATE FUNCTION f1(a INT) RETURNS INT
|
||||
BEGIN
|
||||
IF (a < 3) THEN
|
||||
@ -58,8 +60,30 @@ BEGIN
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
--echo 'Bug: Create Function should give error here because non-super user';
|
||||
--echo 'is creating function here';
|
||||
--echo ## Creating new function f1 fails because non-super user ##
|
||||
delimiter |;
|
||||
--error ER_BINLOG_CREATE_ROUTINE_NEED_SUPER
|
||||
CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC
|
||||
BEGIN
|
||||
IF (a < 3) THEN
|
||||
INSERT INTO t2 VALUES (a);
|
||||
END IF;
|
||||
RETURN 1;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
connection default;
|
||||
|
||||
--echo ## Creating new function f1 succeeds ##
|
||||
delimiter |;
|
||||
CREATE FUNCTION f1(a INT) RETURNS INT DETERMINISTIC
|
||||
BEGIN
|
||||
IF (a < 3) THEN
|
||||
INSERT INTO t2 VALUES (a);
|
||||
END IF;
|
||||
RETURN 1;
|
||||
END|
|
||||
delimiter ;|
|
||||
|
||||
--echo ## Creating new table t1 ##
|
||||
CREATE TABLE t1 (a INT);
|
||||
|
Reference in New Issue
Block a user