Bug #113304 Unexpected Result for LEAST function
Submitted: 1 Dec 2023 7:52 Modified: 1 Dec 2023 8:19
Reporter: JINSHENG BA Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S1 (Critical)
Version:8.2.0, 8.0.35 OS:Any
Assigned to: CPU Architecture:Any

[1 Dec 2023 7:52] JINSHENG BA
Description:
CREATE TABLE t0(c0 LONGTEXT) ;
INSERT INTO t0(c0) VALUES(0.1);
CREATE TABLE t1(c0 INT ZEROFILL PRIMARY KEY) ;
INSERT IGNORE INTO t1(c0) VALUES(NULL);

SELECT !((LEAST(t0.c0, t1.c0)) || (t1.c0)) FROM t1, t0; -- {0}
SELECT * FROM t1, t0 WHERE !((LEAST(t0.c0, t1.c0)) || (t1.c0)); -- {0000000000, 0.1}

In the first query, the expression !((LEAST(t0.c0, t1.c0)) is evaluated to false, while the second query still returns non-empty result.

How to repeat:
docker run -it -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql:8.2.0

Then execute the above test case.
[1 Dec 2023 8:19] MySQL Verification Team
Hello Jinsheng Ba,

Thank you for the report and test case.
Verified as described.

regards,
Umesh
[14 Oct 15:24] OCA Admin
Contribution submitted via Github - bug-113304 Unexpected Result for LEAST function 
(*) Contribution by c q (Github hotdb-cq, mysql-server/pull/574#issuecomment-2410655889): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: git_patch_2122296074.txt (text/plain), 1.58 KiB.