Bug #95937 BENCHMARK() returns NULL in some cases but is documented to always return 0
Submitted: 23 Jun 2019 22:54 Modified: 25 Jul 2019 13:36
Reporter: Manuel Rigger Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:8.0.16, 5.7, 5.6 OS:Ubuntu
Assigned to: CPU Architecture:x86

[23 Jun 2019 22:54] Manuel Rigger
Description:
The BENCHMARK() function is documented to always return the same constant number (see https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_benchmark):

"The result value is always 0."

However, passing NULL as first argument or a negative number causes the function to return NULL.

How to repeat:
SELECT BENCHMARK(NULL, 1); -- expected: 0, actual: NULL
SELECT BENCHMARK(-1, 1); -- expected: 0, actual: NULL
[24 Jun 2019 4:33] MySQL Verification Team
Hello Manuel Rigger,

Thank you for the report.

regards,
Umesh
[25 Jul 2019 13:36] Paul Dubois
Posted by developer:
 
Updated description:

The result value is 0, or NULL for inappropriate arguments such as a NULL or negative repeat count.