Bug #5985 prepare stmt from "select rand(?)" crashes server
Submitted: 8 Oct 2004 16:20 Modified: 13 Oct 2004 23:09
Reporter: Konstantin Osipov (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.* OS:Any (All)
Assigned to: Konstantin Osipov CPU Architecture:Any

[8 Oct 2004 16:20] Konstantin Osipov
Description:
prepare stmt from "select rand(?)" crashes server

How to repeat:
See description

Suggested fix:
Don't call val_int() if item is not constant in Item_func_rand::fix_length_and_dec.
[12 Oct 2004 23:37] Konstantin Osipov
Subject: bk commit - 4.1 tree (konstantin:1.2089) BUG#5985
ChangeSet
  1.2089 04/10/13 03:27:11 konstantin@mysql.com +9 -0
  A fix and test case for Bug#5985 ""prepare stmt from "select rand(?)"
  crashes server." The fix makes Item_func_rand prepared-statements
  aware plus it fixes the case when RAND is used in prepared
  statements and replication is on (as well as several similar issues).
  Until now we did not reset THD before every execution of a prepared
  statement, so if some execution had set thd->time_zone_used
  or thd->rand_used they would not be reset until next mysql_parse.
[13 Oct 2004 23:09] Konstantin Osipov
Fixed in 4.1.7