Bug #112111 Incorrect query results on comparing with SOME including some null value
| Submitted: | 18 Aug 2023 8:54 | Modified: | 18 Aug 2023 12:50 |
|---|---|---|---|
| Reporter: | John Jove | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 8.1.0 | OS: | Any |
| Assigned to: | CPU Architecture: | Any |
[18 Aug 2023 12:50]
MySQL Verification Team
Hi Mr. Jove, Thank you for your bug report. However, we can not repeat your behaviour, since we get an empty result: With a test case exactly like yours, we get: --------------- --------------- Empty result. Here is a test case we used: ------------------ DROP TABLE IF EXISTS t1; CREATE TABLE t1(c1 DECIMAL) ; INSERT INTO t1 VALUES(-1); INSERT INTO t1 VALUES(NULL); SELECT '---------------'; SELECT c1 FROM t1 WHERE ((1 >= SOME (SELECT `c1` FROM t1)) IS TRUE) IS FALSE; SELECT '---------------'; DROP TABLE IF EXISTS t1; ------------------ Then we changed your test case, to see what is happening when we break your query into the steps, one by one, like this: ------------------ DROP TABLE IF EXISTS t1; CREATE TABLE t1(c1 DECIMAL) ; INSERT INTO t1 VALUES(-1); INSERT INTO t1 VALUES(NULL); SELECT '---------------'; SELECT c1 FROM t1 WHERE (1 >= SOME (SELECT `c1` FROM t1)); SELECT '---------------'; SELECT c1 FROM t1 WHERE (1 >= SOME (SELECT `c1` FROM t1)) IS TRUE; SELECT '---------------'; SELECT c1 FROM t1 WHERE ((1 >= SOME (SELECT `c1` FROM t1)) IS TRUE) IS FALSE; DROP TABLE IF EXISTS t1; ------------------------- Then we get these results, where again, the final query returns an empty result: --------------- c1 -1 NULL --------------- c1 -1 NULL --------------- --------------- ------------------ Hence, as you can see, all the results are as expected, but the final query returns zero rows. Can't repeat.
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.
Description: Run the following statements, in which the SELECT statement returns an incorrect query result {-1}, {null}, which is expected to be empty. How to repeat: DROP TABLE IF EXISTS t1; CREATE TABLE t1(c1 DECIMAL) ; INSERT INTO t1 VALUES(-1); INSERT INTO t1 VALUES(NULL); SELECT c1 FROM t1 WHERE ((1 >= SOME (SELECT `c1` FROM t1)) IS TRUE) IS FALSE; -- actual: {-1}, {null}, expected: {}