Bug #118061 wrong inner join result when adding an additional true expression
Description:
Hi, MySQL developers,
Please see the below cases.
```
CREATE TABLE t0(c0 TEXT);
CREATE TABLE t1(c0 INT ZEROFILL);
INSERT INTO t0(c0) VALUES('0.1');
INSERT INTO t1(c0) VALUES(0);
select * from t0 inner join t1 on (((GREATEST(t0.c0, t1.c0)) = (t1.c0)));
-- t0.c0, t1.c0
-- 0.1, 0
select * from t0 inner join t1 on (((GREATEST(t0.c0, t1.c0)) = (t1.c0))) and t1.c0=0.0;
-- t0.c0, t1.c0
-- 0.1, 0
select * from t0 inner join t1 on (((GREATEST(t0.c0, t1.c0)) = (t1.c0))) and t1.c0=0;
-- empty result
-- wrong, should be same as the above two queries
```
In the second query, when we add a true expression 't1.c0=0.0', the query produces the same result as that of the first query. But when we change 't1.c0=0.0' into 't1.c0=0' as shown in the third query, the third query produces an empty result.
How to repeat:
```
CREATE TABLE t0(c0 TEXT);
CREATE TABLE t1(c0 INT ZEROFILL);
INSERT INTO t0(c0) VALUES('0.1');
INSERT INTO t1(c0) VALUES(0);
select * from t0 inner join t1 on (((GREATEST(t0.c0, t1.c0)) = (t1.c0)));
-- t0.c0, t1.c0
-- 0.1, 0
select * from t0 inner join t1 on (((GREATEST(t0.c0, t1.c0)) = (t1.c0))) and t1.c0=0.0;
-- t0.c0, t1.c0
-- 0.1, 0
select * from t0 inner join t1 on (((GREATEST(t0.c0, t1.c0)) = (t1.c0))) and t1.c0=0;
-- empty result
-- wrong, should be same as the above two queries
```
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.037 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: Hi, MySQL developers, Please see the below cases. ``` CREATE TABLE t0(c0 TEXT); CREATE TABLE t1(c0 INT ZEROFILL); INSERT INTO t0(c0) VALUES('0.1'); INSERT INTO t1(c0) VALUES(0); select * from t0 inner join t1 on (((GREATEST(t0.c0, t1.c0)) = (t1.c0))); -- t0.c0, t1.c0 -- 0.1, 0 select * from t0 inner join t1 on (((GREATEST(t0.c0, t1.c0)) = (t1.c0))) and t1.c0=0.0; -- t0.c0, t1.c0 -- 0.1, 0 select * from t0 inner join t1 on (((GREATEST(t0.c0, t1.c0)) = (t1.c0))) and t1.c0=0; -- empty result -- wrong, should be same as the above two queries ``` In the second query, when we add a true expression 't1.c0=0.0', the query produces the same result as that of the first query. But when we change 't1.c0=0.0' into 't1.c0=0' as shown in the third query, the third query produces an empty result. How to repeat: ``` CREATE TABLE t0(c0 TEXT); CREATE TABLE t1(c0 INT ZEROFILL); INSERT INTO t0(c0) VALUES('0.1'); INSERT INTO t1(c0) VALUES(0); select * from t0 inner join t1 on (((GREATEST(t0.c0, t1.c0)) = (t1.c0))); -- t0.c0, t1.c0 -- 0.1, 0 select * from t0 inner join t1 on (((GREATEST(t0.c0, t1.c0)) = (t1.c0))) and t1.c0=0.0; -- t0.c0, t1.c0 -- 0.1, 0 select * from t0 inner join t1 on (((GREATEST(t0.c0, t1.c0)) = (t1.c0))) and t1.c0=0; -- empty result -- wrong, should be same as the above two queries ```