Bug #7115 Prepared Statements: packet error if execution within stored procedure
Submitted: 8 Dec 2004 22:09 Modified: 10 Jun 2005 18:26
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3-alpha-debug OS:Linux (SUSE 9.2)
Assigned to: Konstantin Osipov CPU Architecture:Any

[8 Dec 2004 22:09] Peter Gulutzan
Description:
If I PREPARE a statement, then make a stored procedure to EXECUTE it, 
then I get a "Packets out of order" error the second time I call the procedure. 
 

How to repeat:
mysql> prepare x from 'select 1'; 
Query OK, 0 rows affected (0.00 sec) 
Statement prepared 
 
mysql> create procedure p () execute x; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> call p(); 
+---+ 
| 1 | 
+---+ 
| 1 | 
+---+ 
1 row in set (0.00 sec) 
 
mysql> call p(); 
Packets out of order (Found: 6, expected 1) 
ERROR 2013 (HY000): Lost connection to MySQL server during query
[9 Dec 2004 10:22] Hartmut Holzgraefe
Using a bk build from Dec 8, about 22:00pm on SuSE 9.0 i couldn't repeat this ...
[10 Dec 2004 22:49] Peter Gulutzan
I have consulted another MySQL Developer (Guilhem Bichot, using Mandrake 9.2 with 
a build from yesterday). The bug is repeatable on his machine too. I am changing this back 
to "Open" status since it can after all be repeated.
[26 Jan 2005 19:46] Jorge del Conde
C:\my\mysql\bin>mysql test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 5.0.2-alpha-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> prepare x from 'select 1';
Query OK, 0 rows affected (0.00 sec)
Statement prepared

mysql> create procedure p () execute x;
Query OK, 0 rows affected (0.04 sec)

mysql> call p();
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)

mysql> call p();
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
[18 Apr 2005 21:29] Konstantin Osipov
We might have to forbid PREPARE command in stored procedures.
Prepare doesn't work with the new SP prelocking algorithm currently utilized in 5.0.
[8 Jun 2005 21:53] Konstantin Osipov
Dynamic SQL is disabled in 5.0.8
Subject: bk commit - 5.0 tree (konstantin:1.1958) BUG#10605

ChangeSet
  1.1958 05/06/09 01:09:05 konstantin@mysql.com +3 -0
  Disable dynamic SQL in stored routines.
  This is to close Bug#10975, Bug#7115, Bug#10605
  This feature will be implemented in a future release.
[10 Jun 2005 18:26] Paul Dubois
Noted in 5.0.8 changelog.  Added note to prepared
statement section that SQL PS cannot be used in
stored routines.