Bug #67548 | SLEEP() accepts smaller time argument than microseconds - contradicts docs | ||
---|---|---|---|
Submitted: | 10 Nov 2012 13:06 | Modified: | 22 Feb 2013 3:26 |
Reporter: | Peter Laursen (Basic Quality Contributor) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Errors | Severity: | S3 (Non-critical) |
Version: | 5.1.63, 5.5.28, 5.6.8 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[10 Nov 2012 13:06]
Peter Laursen
[10 Nov 2012 13:07]
Peter Laursen
I forgot: Also "SELECT SLEEP(-99);" executes with no error or warning. This simply makes no sense! I assume it truncates to "SELECT SLEEP(0);"
[10 Nov 2012 13:11]
Peter Laursen
Not sure what category to choose for this, really! Tried my best!
[10 Nov 2012 13:59]
Sveta Smirnova
Thank you for the report. Verified as described. Since this report about lack of the warning mostly I think category is correct.
[10 Nov 2012 16:34]
Peter Laursen
A few more 'oddities': 1) You may actually use FLOAT notation: SELECT 25E-1; -- "2.5" SELECT SLEEP(25E-1); -- Sleeps for 2.5 secs -- but now see the behavior with "25E+13". This number is withing the MAXINT range SELECT 25E+13; -- "250000000000000" .. but SELECT SLEEP(25E+13) -- returns "0" immediately. -- "25E+13" is truncated to "0" it seems. So what is the max argument supplied to SLEEP() that does not truncate? "25E+9" truncates but "25E+8" does not on my environment. 2) Also those statements execute with the argument truncated to "0" without a warning/error: SELECT SLEEP(NULL); SELECT SLEEP('a');
[11 Nov 2012 10:22]
Peter Laursen
At least the behavior with SLEEP(NULL) differs from other functions like SELECT SIN(NULL); -- returns NULL It could also be an option to return NULL in all cases where no SLEEP occurs do to argument being "0" or "NULL" (explicitly set or implicitly due to truncation).
[22 Feb 2013 3:26]
Paul DuBois
Noted in 5.7.1 changelog. SLEEP() produced no warning or error for NULL or negative arguments. Now it produces a warning, or an error in strict SQL mode. Will also change the SLEEP() description to say that it permits a fractional part in the argument, without being specific about "microseconds."