Bug #3418 RAND()
Submitted: 8 Apr 2004 1:40 Modified: 11 Apr 2004 17:41
Reporter: Wolfgang Wolf Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S1 (Critical)
Version:5.0.0a OS:Windows (Windows 2000)
Assigned to: CPU Architecture:Any

[8 Apr 2004 1:40] Wolfgang Wolf
Description:
The RAND() function causes a crash when used in a stored function.

How to repeat:
DELIMITER //;

CREATE FUNCTION my14() RETURNS CHAR(16)
BEGIN
  RETURN RAND();
END;
//

DELIMITER ;//

show function status;

SELECT my14();

Suggested fix:
-
[11 Apr 2004 17:41] MySQL Verification Team
Thank you for the bug report I was able to repeat with the release
package 5.0.0, however this was already fixed in our BK source tree:

mysql> show function status\G
<cut>
*************************** 4. row ***************************
           Db: test
         Name: my14
         Type: FUNCTION
      Definer: root@localhost
     Modified: 0000-00-00 00:00:00
      Created: 2004-04-11 21:36:41
Security_type: DEFINER
      Comment:
4 rows in set (0.01 sec)

mysql> SELECT my14()\G
*************************** 1. row ***************************
my14(): 0.75055334973201
1 row in set (0.00 sec)

mysql> select version();
+-----------------------+
| version()             |
+-----------------------+
| 5.0.1-alpha-max-debug |
+-----------------------+
1 row in set (0.00 sec)