Commit f3a877ab authored by unknown's avatar unknown

Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.1-maint

into  salvation.intern.azundris.com:/home/tnurnberg/work/mysql-5.1-maint-16456


mysql-test/r/func_time.result:
  Auto merged
mysql-test/t/disabled.def:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
parents 266bf339 beea1235
...@@ -104,10 +104,10 @@ begin ...@@ -104,10 +104,10 @@ begin
insert into t2 values(20),(20); insert into t2 values(20),(20);
end| end|
call foo4(); call foo4();
ERROR 23000: Duplicate entry '20' for key 1 ERROR 23000: Duplicate entry '20' for key 'a'
show warnings; show warnings;
Level Code Message Level Code Message
Error 1062 Duplicate entry '20' for key 1 Error 1062 Duplicate entry '20' for key 'a'
select * from t2; select * from t2;
a a
20 20
...@@ -124,6 +124,9 @@ select * from mysql.proc where name="foo4" and db='mysqltest1'; ...@@ -124,6 +124,9 @@ select * from mysql.proc where name="foo4" and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
select * from mysql.proc where name="foo4" and db='mysqltest1'; select * from mysql.proc where name="foo4" and db='mysqltest1';
db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment
set binlog_format=STATEMENT;
call foo();
ERROR HY000: Slave running with --log-slave-updates must use row-based binary logging to be able to replicate row-based binary log events
drop procedure foo; drop procedure foo;
drop procedure foo2; drop procedure foo2;
drop procedure foo3; drop procedure foo3;
...@@ -181,7 +184,7 @@ end| ...@@ -181,7 +184,7 @@ 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) 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)
set global log_bin_trust_routine_creators=1; set global log_bin_trust_routine_creators=1;
Warnings: Warnings:
Warning 1287 'log_bin_trust_routine_creators' is deprecated; use 'log_bin_trust_function_creators' instead Warning 1541 The syntax 'log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use 'log_bin_trust_function_creators' instead
set global log_bin_trust_function_creators=0; set global log_bin_trust_function_creators=0;
set global log_bin_trust_function_creators=1; set global log_bin_trust_function_creators=1;
set global log_bin_trust_function_creators=1; set global log_bin_trust_function_creators=1;
...@@ -241,9 +244,9 @@ return 10; ...@@ -241,9 +244,9 @@ return 10;
end| end|
do fn1(100); do fn1(100);
Warnings: Warnings:
Error 1062 Duplicate entry '100' for key 1 Error 1062 Duplicate entry '100' for key 'a'
select fn1(20); select fn1(20);
ERROR 23000: Duplicate entry '20' for key 1 ERROR 23000: Duplicate entry '20' for key 'a'
select * from t2; select * from t2;
a a
20 20
...@@ -252,8 +255,17 @@ select * from t2; ...@@ -252,8 +255,17 @@ select * from t2;
a a
20 20
100 100
set binlog_format=STATEMENT;
create function fn16456()
returns int
begin
return unix_timestamp();
end|
select fn16456();
ERROR HY000: Slave running with --log-slave-updates must use row-based binary logging to be able to replicate row-based binary log events
drop function fn16456;
create trigger trg before insert on t1 for each row set new.a= 10; create trigger trg before insert on t1 for each row set new.a= 10;
ERROR 42000: Access denied; you need the SUPER privilege for this operation ERROR 42000: TRIGGER command denied to user 'zedjzlcsjhd'@'localhost' for table 't1'
delete from t1; delete from t1;
create trigger trg before insert on t1 for each row set new.a= 10; create trigger trg before insert on t1 for each row set new.a= 10;
insert into t1 values (1); insert into t1 values (1);
...@@ -364,6 +376,12 @@ return 10; ...@@ -364,6 +376,12 @@ return 10;
end end
master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(100) master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(100)
master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20) master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `fn1`(20)
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function fn16456()
returns int
begin
return unix_timestamp();
end
master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn16456
master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10
master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1)
...@@ -465,3 +483,5 @@ RETURN 0 ...@@ -465,3 +483,5 @@ RETURN 0
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP FUNCTION f1; DROP FUNCTION f1;
drop table t1; drop table t1;
End of 5.0 tests
End of 5.1 tests
...@@ -25,7 +25,6 @@ rpl_ndb_ddl : BUG#18946 result file needs update + test needs to ch ...@@ -25,7 +25,6 @@ rpl_ndb_ddl : BUG#18946 result file needs update + test needs to ch
rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement
rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement
rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly
rpl_sp : BUG#16456 2006-02-16 jmiller
rpl_multi_engine : BUG#22583 2006-09-23 lars rpl_multi_engine : BUG#22583 2006-09-23 lars
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
# still accepted (this test also checks that the new name is # still accepted (this test also checks that the new name is
# accepted). The old name could be removed in 5.1 or 6.0. # accepted). The old name could be removed in 5.1 or 6.0.
source include/have_binlog_format_mixed.inc;
source include/master-slave.inc; source include/master-slave.inc;
# we need a db != test, where we don't have automatic grants # we need a db != test, where we don't have automatic grants
...@@ -172,6 +173,15 @@ select * from mysql.proc where name="foo4" and db='mysqltest1'; ...@@ -172,6 +173,15 @@ select * from mysql.proc where name="foo4" and db='mysqltest1';
sync_slave_with_master; sync_slave_with_master;
select * from mysql.proc where name="foo4" and db='mysqltest1'; select * from mysql.proc where name="foo4" and db='mysqltest1';
# fail if non-deterministic SP is called in SBR, bug#16456
let $oblf=`select @@SESSION.BINLOG_FORMAT`;
set binlog_format=STATEMENT;
--error ER_BINLOG_ROW_RBR_TO_SBR
call foo();
--disable_query_log
eval set binlog_format=$oblf;
--enable_query_log
# ********************** PART 2 : FUNCTIONS *************** # ********************** PART 2 : FUNCTIONS ***************
connection master; connection master;
...@@ -316,10 +326,31 @@ sync_slave_with_master; ...@@ -316,10 +326,31 @@ sync_slave_with_master;
# check that this failed-in-the-middle replicated right: # check that this failed-in-the-middle replicated right:
select * from t2; select * from t2;
# fail if non-deterministic SF is called in SBR, bug#16456
connection master;
let $oblf=`select @@SESSION.BINLOG_FORMAT`;
set binlog_format=STATEMENT;
delimiter |;
create function fn16456()
returns int
begin
return unix_timestamp();
end|
delimiter ;|
--error ER_BINLOG_ROW_RBR_TO_SBR
select fn16456();
--disable_query_log
eval set binlog_format=$oblf;
--enable_query_log
drop function fn16456;
# ********************** PART 3 : TRIGGERS *************** # ********************** PART 3 : TRIGGERS ***************
connection con1; connection con1;
--error 1227 # now fails due to missing trigger grant (err 1142 i/o 1227) due to new
# check in sql_trigger.cc (v1.44) by anozdrin on 2006/02/01 --azundris
--error ER_TABLEACCESS_DENIED_ERROR
create trigger trg before insert on t1 for each row set new.a= 10; create trigger trg before insert on t1 for each row set new.a= 10;
connection master; connection master;
......
...@@ -4995,6 +4995,18 @@ Item_func_sp::execute_impl(THD *thd, Field *return_value_fld) ...@@ -4995,6 +4995,18 @@ Item_func_sp::execute_impl(THD *thd, Field *return_value_fld)
if (find_and_check_access(thd)) if (find_and_check_access(thd))
goto error; goto error;
/*
Throw an error if a non-deterministic function is called while
statement-based replication (SBR) is active.
*/
if (!m_sp->m_chistics->detistic &&
(mysql_bin_log.is_open() &&
thd->variables.binlog_format == BINLOG_FORMAT_STMT))
{
my_error(ER_BINLOG_ROW_RBR_TO_SBR, MYF(0));
goto error;
}
/* /*
Disable the binlogging if this is not a SELECT statement. If this is a Disable the binlogging if this is not a SELECT statement. If this is a
SELECT, leave binlogging on, so execute_function() code writes the SELECT, leave binlogging on, so execute_function() code writes the
......
...@@ -4576,6 +4576,18 @@ mysql_execute_command(THD *thd) ...@@ -4576,6 +4576,18 @@ mysql_execute_command(THD *thd)
goto error; goto error;
} }
/*
Throw an error if a non-deterministic procedure is called while
statement-based replication (SBR) is active.
*/
if (!sp->m_chistics->detistic &&
(mysql_bin_log.is_open() &&
thd->variables.binlog_format == BINLOG_FORMAT_STMT))
{
my_error(ER_BINLOG_ROW_RBR_TO_SBR, MYF(0));
goto error;
}
my_bool nsok= thd->net.no_send_ok; my_bool nsok= thd->net.no_send_ok;
thd->net.no_send_ok= TRUE; thd->net.no_send_ok= TRUE;
if (sp->m_flags & sp_head::MULTI_RESULTS) if (sp->m_flags & sp_head::MULTI_RESULTS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment