Description:
If the where condition is "col_1 is not null" or "col_1 is null" in a query statement in the form of "Left join (select 1 from test1) AS sub_1(col_1) ON (false)", the query result is incorrect.
How to repeat:
create table test1 ( id int);
insert into test1 values (1),(2);
create table test2( a int );
insert into test2 values (100),(120),(600);
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.41 |
+-----------+
1 row in set (0.00 sec)
mysql> select * from (select * from test2 LEFT JOIN (select 1 from test1) AS sub_1(col_1) ON (false)) as dt;
+------+-------+
| a | col_1 |
+------+-------+
| 100 | NULL |
| 120 | NULL |
| 600 | NULL |
+------+-------+
3 rows in set (0.00 sec)
mysql> select * from (select * from test2 LEFT JOIN (select 1 from test1) AS sub_1(col_1) ON (false)) as dt where col_1 is null;
Empty set (0.00 sec)
mysql> select * from (select * from test2 LEFT JOIN (select 1 from test1) AS sub_1(col_1) ON (false)) as dt where col_1 is not null;
+------+-------+
| a | col_1 |
+------+-------+
| 100 | NULL |
| 120 | NULL |
| 600 | NULL |
+------+-------+
3 rows in set (0.00 sec)