Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
c7717d92
Commit
c7717d92
authored
Aug 22, 2013
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge
parents
f74c745a
8d8ad548
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
1 deletion
+58
-1
mysql-test/r/delete_returning.result
mysql-test/r/delete_returning.result
+22
-0
mysql-test/t/delete_returning.test
mysql-test/t/delete_returning.test
+25
-1
sql/sp_head.cc
sql/sp_head.cc
+11
-0
No files found.
mysql-test/r/delete_returning.result
View file @
c7717d92
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;
mysql-test/t/delete_returning.test
View file @
c7717d92
#
# 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
;
sql/sp_head.cc
View file @
c7717d92
...
...
@@ -312,6 +312,17 @@ sp_get_flags_for_command(LEX *lex)
case
SQLCOM_UNINSTALL_PLUGIN
:
flags
=
sp_head
::
HAS_COMMIT_OR_ROLLBACK
;
break
;
case
SQLCOM_DELETE
:
{
if
(
lex
->
select_lex
.
item_list
.
is_empty
())
flags
=
0
;
else
{
/* This is DELETE ... RETURNING ... */
flags
=
sp_head
::
MULTI_RESULTS
;
}
break
;
}
default:
flags
=
0
;
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment