Skip to content

Unexpected result when using IN with DATE values #13380

Description

@suyZhong

What happens?

Consider the following test cases. The first query should return true since the timestamp after casting is 2024-08-09 and the IN expression should be evaluated to true. Besides, if the false is expected, its negation query should not be evaluated as false.

It could be reproduced on both the newest source version and the nightly build.

To Reproduce

CREATE TABLE t1(c0 TIMESTAMP) ;
INSERT INTO t1(c0) VALUES ('2024-08-09 14:48:00');

SELECT * FROM t1; -- 2024-08-09 14:48:00
SELECT (CAST(t1.c0 AS DATE) IN ('2024-08-09')) FROM t1; -- false (unexpected)
SELECT NOT (CAST(t1.c0 AS DATE) IN ('2024-08-09')) FROM t1; -- false

OS:

ubuntu 22.04

DuckDB Version:

v1.0.1-dev4052 f5ab7c1

DuckDB Client:

CLI

Full Name:

Suyang Zhong

Affiliation:

NUS

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a source build

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions