Bug #119619 Incorrect results for REPLACE function

Submitted: 4 Jan 14:07 Modified: 4 Jan 21:17
Reporter: John Jove Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S1 (Critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[4 Jan 14:07] John Jove
Description:
Run the following statements, which are expected to return 1133133.

How to repeat:
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT UNSIGNED);
INSERT INTO t1 VALUES (133);
SELECT (REPLACE((IF(c1, c1, c1)), (BIT_COUNT(c1)), c1)) FROM t1 GROUP BY c1; -- actual: {113313}, expected: {1133133}
[4 Jan 14:09] John Jove
The following case may help to fix the problem.

DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT UNSIGNED);
INSERT INTO t1 VALUES (133);
SELECT (REPLACE((IF(c1, c1, c1)), (BIT_COUNT(c1)), c1)) FROM t1 GROUP BY c1; -- {1133133}
[4 Jan 21:17] Roy Lyseng
Verified as described.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.