Bug #79912 Function REPLACE with binary op doesn't return expected NULL, with param as NULL
Submitted: 11 Jan 2016 7:10 Modified: 20 Jan 2016 16:51
Reporter: Su Dylan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.7.8,5.5.48, 5.6.28, 5.7.10 OS:Any
Assigned to: CPU Architecture:Any

[11 Jan 2016 7:10] Su Dylan
Description:
Output:
=====
mysql> SELECT REPLACE( 'a', binary 'b', NULL );
+----------------------------------+
| REPLACE( 'a', binary 'b', NULL ) |
+----------------------------------+
| a                                |
+----------------------------------+
1 row in set (0.00 sec)

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

Problem:
=====
NULL expected.

How to repeat:
SELECT REPLACE( 'a', binary 'b', NULL );

Suggested fix:
Return NULL.
[11 Jan 2016 8:03] MySQL Verification Team
Hello Su Dylan,

Thank you for the report and test case.
Observed that 5.5.48/5.6.28/5.7.10 are affected.

Thanks,
Umesh
[20 Jan 2016 16:51] Paul DuBois
Noted in 5.8.0 changelog.

REPLACE('a', BINARY 'b', NULL) returned 'a' rather than NULL.