Skip to content

Unexpected result when using OR #15592

Closed

Description

@suyZhong

CrateDB version

CrateDB 5.7.0-SNAPSHOT built 48bcbc7

CrateDB setup information

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

Problem description

The third SELECT returns an empty result, which is surprising, given that the result of second query is TRUE. The value of the WHERE condition is TRUE, and thus the third query should return the whole table.

Steps to Reproduce

DROP TABLE IF EXISTS t0;

CREATE TABLE t0(c0 VARCHAR, c1 BOOLEAN, PRIMARY KEY(c0)); -- PK is needed
INSERT INTO t0 (c0, c1) VALUES ('a', true);
REFRESH TABLE t0;

SELECT * FROM t0; -- 'a' TRUE
SELECT (t0.c1) OR (t0.c0 = 'b') FROM t0; -- TRUE
SELECT * FROM t0 WHERE (t0.c1) OR (t0.c0 = 'b');
-- Expected: 'a' TRUE
-- Actual: empty table

Actual Result

Empty

Expected Result

'a' TRUE

Activity

  1. added
    triageAn issue that needs to be triaged by a maintainer
    on Feb 22, 2024
  2. self-assigned this
    on Feb 22, 2024
  3. added
    bugClear identification of incorrect behaviour
    and removed
    triageAn issue that needs to be triaged by a maintainer
    on Feb 22, 2024
  4. added 3 commits that reference this issue on Feb 25, 2024
    8949fe6
    a8d2357
    53fd0f8
  5. added 3 commits that reference this issue on Feb 26, 2024
    fbbeebf
    c0ea438
    e95426c
  6. matriv commented on Feb 26, 2024

    @matriv
    Contributor

    Thx a lot for reporting this issue @suyZhong, the fix will be available with the next hotfix release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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