bigquery-emulator
bigquery-emulator copied to clipboard
Queries on TIMESTAMP columns are not handled correctly when no timezone is specified
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)?
-
INSERT INTO my_table (t) VALUES (
2023-08-01T01:00:00.000000Z`) -
SELECT * FROM my_table WHERE t= "2023-08-01T01:00:00.000000"
Anything else we need to know?
No response
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? https://github.com/goccy/go-zetasql/issues/27