mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +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.
This commit is contained in:
@@ -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