mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 21:12:26 +01:00
043e09b543
If the log_bin_trust_function_creators option is not defined, creating a stored function requires either one of the modifiers DETERMINISTIC, NO SQL, or READS SQL DATA. Executing a stored function should also follows the same rules if in STATEMENT mode. However, this was not happening and a wrong error was being printed out: ER_BINLOG_ROW_RBR_TO_SBR. The patch makes the creation and execution compatible and prints out the correct error ER_BINLOG_UNSAFE_ROUTINE when a stored function without one of the modifiers above is executed in STATEMENT mode.
68 lines
1.7 KiB
Text
68 lines
1.7 KiB
Text
set global log_bin_trust_function_creators=0;
|
|
set binlog_format=STATEMENT;
|
|
create function fn16456()
|
|
returns int
|
|
begin
|
|
return unix_timestamp();
|
|
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)
|
|
set global log_bin_trust_function_creators=1;
|
|
create function fn16456()
|
|
returns int
|
|
begin
|
|
return unix_timestamp();
|
|
end|
|
|
set global log_bin_trust_function_creators=0;
|
|
set binlog_format=ROW;
|
|
select fn16456();
|
|
fn16456()
|
|
timestamp
|
|
set binlog_format=STATEMENT;
|
|
select fn16456();
|
|
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)
|
|
drop function fn16456;
|
|
set global log_bin_trust_function_creators=0;
|
|
create function fn16456()
|
|
returns int deterministic
|
|
begin
|
|
return unix_timestamp();
|
|
end|
|
|
set binlog_format=ROW;
|
|
select fn16456();
|
|
fn16456()
|
|
timestamp
|
|
set binlog_format=STATEMENT;
|
|
select fn16456();
|
|
fn16456()
|
|
timestamp
|
|
drop function fn16456;
|
|
set global log_bin_trust_function_creators=0;
|
|
create function fn16456()
|
|
returns int no sql
|
|
begin
|
|
return unix_timestamp();
|
|
end|
|
|
set binlog_format=ROW;
|
|
select fn16456();
|
|
fn16456()
|
|
timestamp
|
|
set binlog_format=STATEMENT;
|
|
select fn16456();
|
|
fn16456()
|
|
timestamp
|
|
drop function fn16456;
|
|
set global log_bin_trust_function_creators=0;
|
|
create function fn16456()
|
|
returns int reads sql data
|
|
begin
|
|
return unix_timestamp();
|
|
end|
|
|
set binlog_format=ROW;
|
|
select fn16456();
|
|
fn16456()
|
|
timestamp
|
|
set binlog_format=STATEMENT;
|
|
select fn16456();
|
|
fn16456()
|
|
timestamp
|
|
drop function fn16456;
|