Bug #119139 Unexpected error `Incorrect DECIMAL value: '0' for column '' at row -1`

Submitted: 13 Oct 2025 7:30 Modified: 18 Dec 2025 8:56
Reporter: chi zhang (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S1 (Critical)
Version:9.4.0 OS:Any
Assigned to: CPU Architecture:Any

[13 Oct 2025 7:30] chi zhang
Description:
Hi,

The following test case triggers an unexpected error:

```
CREATE TABLE IF NOT EXISTS t0(c0 DECIMAL) ;
INSERT INTO t0(c0) VALUES(1);
CREATE INDEX i0 ON t0(((LEAST("", 1)) > (t0.c0))); -- Incorrect DECIMAL value: '0' for column '' at row -1
```

How to repeat:
```
CREATE TABLE IF NOT EXISTS t0(c0 DECIMAL) ;
INSERT INTO t0(c0) VALUES(1);
CREATE INDEX i0 ON t0(((LEAST("", 1)) > (t0.c0)));
```
[13 Oct 2025 7:37] chi zhang
I find the following DELETE can also trigger this error:
```
CREATE TABLE IF NOT EXISTS t0(c0 DECIMAL);
INSERT INTO t0(c0) VALUES(1);
PREPARE prepare_query FROM 'DELETE LOW_PRIORITY QUICK FROM t0 WHERE (LEAST("", "")) IN (GREATEST(t0.c0, CAST(-1 AS DECIMAL)))';
EXECUTE prepare_query;
```
[18 Dec 2025 8:56] Øystein Grøvlen
Thank you for your bug report.
Verified as described.

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

Page generated in 0.039 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.