Bug #9058 Stored Procedures: Crash if function included SELECT

Submitted: 8 Mar 2005 22:08 Modified: 26 Apr 2005 11:45
Reporter: Trudy Pelzer Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3-alpha-debug OS:Linux (SuSE 9.1)
Assigned to: Assigned Account CPU Architecture:Any

[8 Mar 2005 22:08] Trudy Pelzer
Description:
If I create a function with a SELECT in the routine body,
the server either crashes or returns a "malformed packet"
error after I execute the function, when I try to see the 
result of the execution.

How to repeat:
mysql> Delimiter //

mysql> Create function fn1(a int) returns int Begin Declare b int; SELECT b; return b; End//
Query OK, 0 rows affected (0.00 sec)

mysql> SET @x= Fn1(11)//
+------+
| b    |
+------+
| NULL |
+------+
1 row in set (0.00 sec)
-- This is the correct response from the function's SELECT b; statement.
Variable @x should now be set to NULL.

mysql> SELECT @x//
Packets out of order (Found: 6, expected 1)
ERROR 2013 (HY000): Lost connection to MySQL server during query

-- Now, start up again and do:

mysql> Drop function if exists fn1//
Query OK, 0 rows affected, 2 warnings (0.00 sec)

mysql> Create function fn1(a int) returns int Begin Declare b int; SELECT b; return b; End//
Query OK, 0 rows affected (0.00 sec)

mysql> select fn1(33)//
ERROR 2027 (HY000): Malformed packet
[8 Mar 2005 22:34] MySQL Verification Team
Thank you for the bug report. I got the client lost connection and the
malformed packet error, the server not crashes.
[26 Apr 2005 11:45] Per-Erik Martin
This is a duplicate of BUG#8408.
(Any type of result set from a function will fail.)

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.