Closed hawkingrei closed 6 days ago
A clearer reproduce:
CREATE TABLE t0(
c0 BOOL DEFAULT false UNIQUE,
c1 CHAR NOT NULL DEFAULT '0'
);
CREATE VIEW v0(c0, c1) AS
SELECT
t0.c1,
NULL
FROM
t0
WHERE
t0.c0;
SELECT
v0.c0
FROM
v0 NATURAL
JOIN t0
WHERE
(
false LIKE(v0.c1)
);
TiDB assigns the expressions to projection and column in (*LogicalJoin).updateEQCond()
. In this function, it was an from_binary(t0.c0) = t0.c1
. However, the return type of the from_binary
is TypeNull
. After building the projection, another cast is wrapped around them to make it possible to compare, and cause this bug.
Can't reproduce this issue, it might have been fixed by some other PR:
mysql> SELECT
-> v0.c0
-> FROM
-> v0 NATURAL
-> JOIN t0
-> WHERE
-> (
-> false LIKE(v0.c1)
-> );
Empty set (0.01 sec)
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
succeed
3. What did you see instead (Required)
4. What is your TiDB version? (Required)