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

Queries on TIMESTAMP columns are not handled correctly when no timezone is specified #279

Open
prismec opened this issue Mar 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@prismec
Copy link

prismec commented Mar 7, 2024

What happened?

Given that table my_table with a TIMESTAMP column t, the query
SELECT * FROM my_table WHERE t = "<timestamp value>"
returns no results if <timestamp value> does not contain a timezone, e.g. 2023-08-01T01:00:00.000000.

Using a timezone, e.g. 2023-08-01T01:00:00.000000Z works as expected.

What did you expect to happen?

<timestamp value> 2023-08-01T01:00:00.000000 is equal to 2023-08-01T01:00:00.000000Z.

See also canonical format of the TIMESTAMP datatype: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#timestamp_type

[time_zone]: String representing the time zone. When a time zone is not explicitly specified, the default time zone, UTC, is used.

How can we reproduce it (as minimally and precisely as possible)?

  1. INSERT INTO my_table (t) VALUES (2023-08-01T01:00:00.000000Z`)
  2. SELECT * FROM my_table WHERE t= "2023-08-01T01:00:00.000000"

Anything else we need to know?

No response

@prismec prismec added the bug Something isn't working label Mar 7, 2024
@ohaibbq
Copy link
Contributor

ohaibbq commented Apr 14, 2024

It seems that this will require a change to the Go ZetaSQL bindings.
I'm not familiar with that process, @goccy could you take a look?
goccy/go-zetasql#27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants