diff options
author | Konstantin Osipov <kostja@sun.com> | 2010-04-14 01:56:19 +0400 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2010-04-14 01:56:19 +0400 |
commit | 4288e329dd9676494a9e3927e61492e975277112 (patch) | |
tree | 7a87035df6e8d664a8301574158d57d8305c65cf /mysql-test/suite/rpl/t/rpl_sp.test | |
parent | 71799f6f972d3ba5508c62d8d8ac3e33b25b0f1a (diff) | |
download | mariadb-git-4288e329dd9676494a9e3927e61492e975277112.tar.gz |
A fix for Bug#11918 "SP does not accept variables in LIMIT clause"
Allow stored procedure variables in LIMIT clause.
Only allow variables of INTEGER types.
Handle negative values by means of an implicit cast to UNSIGNED
(similarly to prepared statement placeholders).
Add tests.
Make sure replication works by not doing NAME_CONST substitution
for variables in LIMIT clause.
Add replication tests.
mysql-test/r/sp.result:
Update results (Bug#11918).
mysql-test/suite/rpl/r/rpl_sp.result:
Update results (Bug#11918).
mysql-test/suite/rpl/t/rpl_sp.test:
Add a test case for Bug#11918.
mysql-test/t/sp.test:
Add a test case for Bug#11918.
sql/item.cc:
Mark sp variables in LIMIT clause (a hack for replication).
sql/item.h:
Mark sp variables in LIMIT clause (a hack for replication).
sql/share/errmsg-utf8.txt:
Add a new error message (a type mismatch for LIMIT
clause parameter).
sql/sp_head.cc:
Binlog rewrite sp variables in LIMIT clause without NAME_CONST
substitution.
sql/sql_string.cc:
Implement append_ulonglong method.
sql/sql_string.h:
Declare append_ulonglong().
sql/sql_yacc.yy:
Support stored procedure variables in LIMIT.
Diffstat (limited to 'mysql-test/suite/rpl/t/rpl_sp.test')
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_sp.test | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test index 362bfa17ef3..342ae258a3f 100644 --- a/mysql-test/suite/rpl/t/rpl_sp.test +++ b/mysql-test/suite/rpl/t/rpl_sp.test @@ -679,6 +679,56 @@ drop table t1, t2; --error ER_SP_DOES_NOT_EXIST drop function f1; + +--echo # +--echo # Bug #11918 Can't use a declared variable in LIMIT clause +--echo # +--disable_warnings +drop table if exists t1; +drop procedure if exists p1; +--enable_warnings +connection master; +-- source include/master-slave-reset.inc +connection default; +create table t1 (c1 int); +insert into t1 (c1) values +(1), (2), (3), (4), (5), (6), (7), (8), (9), (10); + +call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); + +create procedure p1(p1 integer) + delete from t1 limit p1; + +set @save_binlog_format=@@session.binlog_format; +set @@session.binlog_format=STATEMENT; + +--disable_warnings +call p1(NULL); +call p1(0); +call p1(1); +call p1(2); +call p1(3); +--enable_warnings + +select * from t1; +sync_slave_with_master; +connection slave; +select * from t1; +connection default; +--disable_warnings +call p1(-1); +--enable_warnings +select * from t1; +sync_slave_with_master; +connection slave; +select * from t1; +connection default; + +--echo # Cleanup +set @@session.binlog_format=@save_binlog_format; +drop table t1; +drop procedure p1; + --echo # End of 5.5 tests. |