Bug #111429 | Incorrect result when timestamp col apply <=> to the result of subquery | ||
---|---|---|---|
Submitted: | 15 Jun 2023 6:44 | Modified: | 15 Jun 2023 7:00 |
Reporter: | Will Chen | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 8.0.22, 8.0.33 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[15 Jun 2023 6:44]
Will Chen
[15 Jun 2023 7:00]
MySQL Verification Team
Hello Will Chen, Thank you for the report and test case. Verified as described. regards, Umesh
[21 Jun 2023 14:02]
huahua xu
Hi all: The issue is caused by the commit https://github.com/mysql/mysql-server/commit/dc80b26d9097bea487e58efa90a1a859ef99f2fc which sets abort_on_null to true about `Item_bool_func2`. Above case would be fine in previous versions(~8.0.16). mysql> select version(); +--------------------+ | version() | +--------------------+ | 8.0.4-rc-debug-log | +--------------------+ mysql> SELECT binary_col,timestamp_col FROM bugtest; +-------------+----------------------------+ | binary_col | timestamp_col | +-------------+----------------------------+ | aaa | 1995-03-04 12:20:00.000000 | | bbb | 1996-03-04 12:20:00.000000 | | NULL | 1997-03-04 12:20:00.000000 | | NULL | 1998-03-04 12:20:00.000000 | | NULL | 1999-03-04 12:20:00.000000 | +-------------+----------------------------+ mysql> SELECT binary_col,timestamp_col FROM bugtest WHERE (binary_col,timestamp_col) <=> (NULL,'1997-03-04 12:20:00.000000') ORDER BY 1 limit 10; +------------+----------------------------+ | binary_col | timestamp_col | +------------+----------------------------+ | NULL | 1997-03-04 12:20:00.000000 | +------------+----------------------------+ mysql> SELECT binary_col,timestamp_col FROM bugtest WHERE (binary_col,timestamp_col) <=> (SELECT binary_col,timestamp_col FROM bugtest ORDER BY 1,2 LIMIT 1) ORDER BY 1 limit 10; +------------+----------------------------+ | binary_col | timestamp_col | +------------+----------------------------+ | NULL | 1997-03-04 12:20:00.000000 | +------------+----------------------------+ mysql> SELECT binary_col,timestamp_col FROM bugtest ORDER BY 1,2 LIMIT 1; +------------+----------------------------+ | binary_col | timestamp_col | +------------+----------------------------+ | NULL | 1997-03-04 12:20:00.000000 | +------------+----------------------------+