Bug #79947 Func ROUND(num, c1(NULL)) doesn't return NULL
Submitted: 13 Jan 2016 7:43 Modified: 13 Jan 2016 9:44
Reporter: Su Dylan Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.7.8, 5.5.48, 5.6.28 OS:Any
Assigned to: CPU Architecture:Any

[13 Jan 2016 7:43] Su Dylan
Description:
Output:
=====
mysql> create table t1(c1 int);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into t1 values(null);
dQuery OK, 1 row affected (0.00 sec)

mysql> select round(9,c1), round(9,NULL) from t1;
+-------------+---------------+
| round(9,c1) | round(9,NULL) |
+-------------+---------------+
|           9 |          NULL |
+-------------+---------------+
1 row in set (0.00 sec)

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.8-rc  |
+-----------+
1 row in set (0.00 sec)

Problem:
=====

How to repeat:

drop table if exists t1;
create table t1(c1 int);
insert into t1 values(null);
select round(9,c1), round(9,NULL) from t1;

Suggested fix:
NULL is returned.
[13 Jan 2016 9:18] Umesh Shastry
Hello Su Dylan,

Thank you for the report and test case.
Observed that 5.6.28/5.5.48 are affected, 5.7.10 build seems to be not affected.

Thanks,
Umesh
[13 Jan 2016 9:44] Tor Didriksen
This is a duplicate of 
Bug #77391 Round function incorrect in where-clause using local variable