Description:
Here are two queries, and I believe the first query should return one row of results.
Actually, the first query returned no results.
mysql> SELECT TRUE from t0 where (NOT ((t0.c0) OR (GREATEST(0.1, t0.c0, '-1849442274', t0.c0)))); -- empty
Empty set (0.00 sec)
mysql> SELECT (NOT ((t0.c0) OR (GREATEST(0.1, t0.c0, '-1849442274', t0.c0)))) from t0; -- {1}
+-----------------------------------------------------------------+
| (NOT ((t0.c0) OR (GREATEST(0.1, t0.c0, '-1849442274', t0.c0)))) |
+-----------------------------------------------------------------+
| 1 |
+-----------------------------------------------------------------+
1 row in set (0.00 sec)
From my observation, this seems to be related to the ZEROFILL attribute.
How to repeat:
DROP TABLE IF EXISTS t0;
CREATE TABLE IF NOT EXISTS t0(c0 TINYINT ZEROFILL NOT NULL) ;
INSERT INTO t0(c0) VALUES(0);
SELECT t0.c0 FROM t0;
SELECT TRUE from t0 where (NOT ((t0.c0) OR (GREATEST(0.1, t0.c0, '-1849442274', t0.c0)))); -- empty
SELECT (NOT ((t0.c0) OR (GREATEST(0.1, t0.c0, '-1849442274', t0.c0)))) from t0; -- {1}