Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 10.0.5
-
Component/s: None
-
Labels:None
Description
CREATE TABLE t1 (i INT); INSERT INTO t1 VALUES (1),(2); --delimiter | CREATE PROCEDURE p (a INT) BEGIN DELETE FROM t1 WHERE i = a RETURNING *; INSERT INTO t1 VALUES (a); END | --delimiter ; CALL p(1); SELECT * FROM t1;
MariaDB [test]> CALL p(1); +------+ | i | +------+ | 1 | +------+ 1 row in set (0.03 sec) MariaDB [test]> SELECT * FROM t1; Error: Packets out of order (Found: 6, expected 1) ERROR 2013 (HY000): Lost connection to MySQL server during query MariaDB [test]>
The "Lost connection ..." error does not signify a server crash, only that the client got disconnected:
ERROR 2013 (HY000): Lost connection to MySQL server during query MariaDB [test]> SELECT * FROM t1; ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection id: 7 Current database: test +------+ | i | +------+ | 2 | | 1 | +------+ 2 rows in set (0.03 sec)
bzr version-info
revision-id: knielsen@knielsen-hq.org-20130816131025-etjrvmfvupsjzq83 revno: 3674 branch-nick: 10.0-base
Gliffy Diagrams
Attachments
Issue Links
- relates to
-
MDEV-3814 Implement DELETE with result set (mwl #205)
-
- Closed
-
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
I have created a stored procedure P2() which is the same like the procedure P in the testcase, except that it has "SELECT * FROM t2" instead of DELETE ... RETURNING.
When I debug two statements, I observe these differences:
in mysql_execute_command(), sql_parse.cc:4354:
P2:
(gdb) p sp->m_flags
$32 = 8 // this is sp_head::MULTI_RESULTS
P:
(gdb) p sp->m_flags
$65 = 0
if sp_head::MULTI_RESULTS is set, then the code right below sets SERVER_MORE_RESULTS_EXISTS in thd->server_status.
This affects further execution. I've put breakpoints in relevant places:
P2:
Protocol::send_result_set_metadata flags=5
Protocol::send_eof (this=0x474ade0, server_status=2090, statement_warn_count=0)
(gdb) p/x server_status & 8
$60 = 0x8
Protocol::send_ok (this=0x474ade0, server_status=2082, statement_warn_count=0, affected_rows=1, last_insert_id=0, message=0x474f0ea "")
P:
Protocol::send_result_set_metadata (this=0x474ade0, list=0x7fff8c016980, flags=5)
Protocol::send_eof (this=0x474ade0, server_status=2082, statement_warn_count=0)
(gdb) p/x server_status & 8
$66 = 0x0
Protocol::send_ok (this=0x474ade0, server_status=2082, statement_warn_count=0, affected_rows=1, last_insert_id=0, message=0x474f0ea "")