Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Comparing TIMESTAMP WITH TIME ZONE and DATE #11959

Closed
2 tasks done
arifsaslam opened this issue May 7, 2024 · 0 comments · Fixed by #11987
Closed
2 tasks done

Issue with Comparing TIMESTAMP WITH TIME ZONE and DATE #11959

arifsaslam opened this issue May 7, 2024 · 0 comments · Fixed by #11987

Comments

@arifsaslam
Copy link

arifsaslam commented May 7, 2024

What happens?

I've encountered an issue when trying to compare a TIMESTAMP WITH TIME ZONE value with a DATE value. Here's the SQL that reproduces the issue:

This works:

set time zone 'UTC';
select date_trunc('day', '2024-05-06 16:09:28+05:00'::timestamptz) == '2024-05-06 17:19:18+05:20'::date as r;

Output:

┌─────────┐
│    r    │
│ boolean │
├─────────┤
│ true    │
└─────────┘

But this does not:

set time zone 'UTC';
select date_trunc('day', '2024-05-06 16:09:28+05:00'::timestamptz) >= '2024-05-06 17:19:18+05:20'::date as r;

Output:

BinderException: Binder Error: Cannot compare values of type TIMESTAMP WITH TIME ZONE and type DATE - an explicit cast is required

To Reproduce

set time zone 'UTC';
select date_trunc('day', '2024-05-06 16:09:28+05:00'::timestamptz) >= '2024-05-06 17:19:18+05:20'::date as r;

OS:

Ubuntu 20.04.5 LTS

DuckDB Version:

0.10.2

DuckDB Client:

python

Full Name:

Arif Aslam

Affiliation:

Mammoth Analytics Inc.

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

I have tested with a stable release

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
hawkfish added a commit to hawkfish/duckdb that referenced this issue May 8, 2024
Add missing case entry for promoting DATE to TIMESTAMPTZ.
This matches PG behaviour.

fixes: duckdb#11959
fixes: duckdblabs/duckdb-internal#2001
Mytherin added a commit that referenced this issue May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants