Skip to content

Unexpected result when using LIKE #15743

Description

@suyZhong

CrateDB version

CrateDB 5.7.0-SNAPSHOT built 46ca1ba

CrateDB setup information

Manual build following the instructions here: https://github.com/crate/crate/blob/master/devs/docs/basics.rst

Problem description

Consider the test case below. It is unexpected that the last query returns an empty result, because the result of the second query is TRUE, which means that the WHERE clause in the last query should be evaluated to TRUE and thus return the row in the table.

Steps to Reproduce

DROP TABLE IF EXISTS t0;

CREATE TABLE t0(c1 VARCHAR);
INSERT INTO t0 (c1) VALUES ('');
REFRESH TABLE t0;

SELECT t0.c1 FROM t0; -- ''
SELECT ((t0.c1!=t0.c1)OR(t0.c1 LIKE (''))) FROM t0; -- TRUE
SELECT t0.c1 FROM t0 WHERE ((t0.c1!=t0.c1)OR(t0.c1 LIKE ('')));
-- Expected: ''
-- Actual: empty

Actual Result

Empty table

Expected Result

''

Metadata

Metadata

Assignees

Labels

bugClear identification of incorrect behaviour

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions