diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2013-08-21 13:51:21 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2013-08-21 13:51:21 +0400 |
commit | 8d8ad548b31c842cf7b5330122820362a017ab80 (patch) | |
tree | 0728c9ddb67975ff533d9f751903e129e6c2a130 /mysql-test | |
parent | 33c66eb7fbcddb09217820708e8ce9324e65db11 (diff) | |
download | mariadb-git-8d8ad548b31c842cf7b5330122820362a017ab80.tar.gz |
MDEV-4919: Packets out of order on a SELECT after calling a procedure with DELETE .. RETURNING
- Let sp_get_flags_for_command() set sp_head::MULTI_RESULTS for DELETE ... RETURNING,
like it does for all statements that return a resultset.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/delete_returning.result | 22 | ||||
-rw-r--r-- | mysql-test/t/delete_returning.test | 26 |
2 files changed, 47 insertions, 1 deletions
diff --git a/mysql-test/r/delete_returning.result b/mysql-test/r/delete_returning.result index fd66c3bb75d..4d8044c1a7a 100644 --- a/mysql-test/r/delete_returning.result +++ b/mysql-test/r/delete_returning.result @@ -1,3 +1,6 @@ +drop table if exists t1,t2; +drop view if exists v1; +drop procedure if exists p1; CREATE TABLE t1 (a int, b varchar(32)); INSERT INTO t1 VALUES (7,'ggggggg'), (1,'a'), (3,'ccc'), @@ -243,3 +246,22 @@ INSERT INTO t2 VALUES (1),(2); DELETE FROM t1 ORDER BY i1 RETURNING ( SELECT i2 FROM t2 ); ERROR 21000: Subquery returns more than 1 row DROP TABLE t1,t2; +# +# MDEV-4919: Packets out of order on a SELECT after calling a procedure with DELETE .. RETURNING +# +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +CREATE PROCEDURE p1 (a INT) +BEGIN +DELETE FROM t1 WHERE i = a RETURNING *; +INSERT INTO t1 VALUES (a); +END | +CALL p1(1); +i +1 +SELECT * FROM t1; +i +1 +2 +DROP PROCEDURE p1; +DROP TABLE t1; diff --git a/mysql-test/t/delete_returning.test b/mysql-test/t/delete_returning.test index 3f40428e0ab..6ca88ee921f 100644 --- a/mysql-test/t/delete_returning.test +++ b/mysql-test/t/delete_returning.test @@ -1,6 +1,11 @@ # # Tests for DELETE FROM <table> ... RETURNING <expr>,... # +--disable_warnings +drop table if exists t1,t2; +drop view if exists v1; +drop procedure if exists p1; +--enable_warnings CREATE TABLE t1 (a int, b varchar(32)); INSERT INTO t1 VALUES @@ -199,4 +204,23 @@ INSERT INTO t2 VALUES (1),(2); --error ER_SUBQUERY_NO_1_ROW DELETE FROM t1 ORDER BY i1 RETURNING ( SELECT i2 FROM t2 ); -DROP TABLE t1,t2;
\ No newline at end of file +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-4919: Packets out of order on a SELECT after calling a procedure with DELETE .. RETURNING +--echo # +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +--delimiter | +CREATE PROCEDURE p1 (a INT) +BEGIN + DELETE FROM t1 WHERE i = a RETURNING *; + INSERT INTO t1 VALUES (a); +END | +--delimiter ; + +CALL p1(1); +SELECT * FROM t1; +DROP PROCEDURE p1; +DROP TABLE t1; + |