Skip to content

Unexpected results when using LIKE with boolean values #8132

Description

@suyZhong

Consider the test case below. It is unexpected that, if the second query returns true, the third query returns an empty result, because the value of the WHERE predicate should be true as well. The last query should return the same result as the first query, i.e., a row with null and false.

CREATE TABLE t0(c1 INT);
CREATE TABLE t1(c1 BOOLEAN);
INSERT INTO t1(c1) VALUES ( false);

SELECT * FROM t0 RIGHT  JOIN t1 ON true; -- null false
SELECT (t1.c1 LIKE (-1 BETWEEN 2 AND t0.c1)) FROM t0 RIGHT  JOIN t1 ON true; -- true
SELECT * FROM t0 RIGHT  JOIN t1 ON true WHERE (t1.c1 LIKE (-1 BETWEEN 2 AND t0.c1));
-- Expected: null false
-- Actual: empty table

I found this in version LI-T6.0.0.362 where I built from source code ecc49e0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions