Skip to content

Unexpected result when querying a partitioned table by a BOOLEAN column #17766

Description

@suyZhong

CrateDB version

CrateDB 6.0.0-SNAPSHOT built f94b10e

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 0 rows 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. PostgreSQL returns one row for the third query.

Steps to Reproduce

DROP TABLE IF EXISTS t1;

CREATE  TABLE  t1(c0 BOOLEAN ,PRIMARY KEY(c0))PARTITIONED BY (c0);
INSERT INTO t1(c0) VALUES (FALSE);
REFRESH TABLE t1;

SELECT * FROM t1; -- FALSE
SELECT ((t1.c0)=(FALSE)) FROM t1; -- TRUE
SELECT * FROM t1 WHERE ((t1.c0)=(FALSE));
-- Expected: FALSE
-- Actual: empty table

Actual Result

empty table

Expected Result

FALSE

Activity

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