Bug #3788 Stored procedure packet error if returns binary
Submitted: 16 May 2004 22:10 Modified: 9 Mar 2005 1:23
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.1-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Antony Curtis CPU Architecture:Any

[16 May 2004 22:10] Peter Gulutzan
Description:
There is a new data type, BINARY. MySQL version 5.0 seems to handle it, sometimes. 
But a function which has RETURNS BINARY(n) causes packets out of order. 
A function which returns VARCHAR(n) BINARY does not cause trouble. 
 

How to repeat:
mysql> create function f222 () returns binary(5) return 5; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> select f222(); 
ERROR 1064 (42000): You have an error in your SQL syntax.  Check the manual that 
corresponds to your MySQL server version for the right syntax to use near 'binary 
return 5' at line 1 
mysql> select 5; 
Packets out of order (Found: 2, expected 1) 
ERROR 2013 (HY000): Lost connection to MySQL server during query
[21 Jul 2004 15:38] Per-Erik Martin
This has changed. The error I get now is a syntax error at first call, which is
due to a bug in the parser. The returns field is not extracted and stored
correctly in the mysql.procl table.
[3 Oct 2004 23:49] Peter Gulutzan
"Packets out of order" also occurs with version 5.0.2 returning DATE, for example: 
 
mysql> create function f25()returns date return current_date; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> select f25(); 
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use near 'returns 
return current_date' at line 1 
mysql> select f25(); 
Packets out of order (Found: 2, expected 1) 
ERROR 2013 (HY000): Lost connection to MySQL server during query
[16 Dec 2004 13:52] Antony Curtis
Patch is stale. Updating to apply against current
[4 Mar 2005 21:57] Antony Curtis
See Bug#2773
[8 Mar 2005 23:03] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/22801
[9 Mar 2005 1:23] Antony Curtis
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html