Bug #5285 Stored procedure wrong row count if function + user variable
Submitted: 29 Aug 2004 4:48 Modified: 28 Sep 2004 10:02
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Bugs System CPU Architecture:Any

[29 Aug 2004 4:48] Peter Gulutzan
Description:
If a function changes a user variable, then a SELECT that uses the function will return too 
many rows. 

How to repeat:
mysql> delimiter // 
mysql> create table t (s1 int)// 
Query OK, 0 rows affected (0.29 sec) 
 
mysql> insert into t values (1)// 
Query OK, 1 row affected (0.00 sec) 
 
mysql> create function f () returns int begin set @a = 5; return 5; end;// 
Query OK, 0 rows affected (0.01 sec) 
 
mysql> select f() from t// 
+-----+ 
| f() | 
+-----+ 
|     | 
|   5 | 
+-----+ 
2 rows in set (0.00 sec)
[28 Sep 2004 10:02] Per-Erik Martin
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

Additional info:

This is no longer repeatable.