Skip to content

Always use iso format and test timezone impact - #75

Merged
theory merged 1 commit into
mainfrom
timestamp-format
Aug 28, 2026
Merged

Always use iso format and test timezone impact#75
theory merged 1 commit into
mainfrom
timestamp-format

Conversation

@theory

@theory theory commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

I noticed that timestamptz values weren't exported with time zone information, which is necessary to ensure proper round-tripping.

Add the date_time_output_format='iso' setting to each chDB query to always format timestamp and timestamptz values in plain text formats with the ISO-8601 format in UTC.

Remove setting the datestyle and timezone GUCs to hard-coded constants, instead allowing them to be respected. Or at least, we respect the timezone GUC for converting timestamp values, but always emit UTC for both timestamp and timestamptz, since that's all that date_time_output_format='iso' supports.

Add a new test file, test/sql/timestamp.sql to test the impact of the new setting on plain-text output, as well as the impact of the timezone setting on timestamp values. Interestingly, setting a time zone in the structure, e.g. DateTime64(3, 'Japan'), has no impact on exported values.

Add the "Timestamp Conversion" section to the chdb_hook docs to document these behaviors.

In passing, change the real columns in test/qa/taxi.sql to double precision, since the source defines the values as Float64.

@theory
theory requested a review from serprex August 28, 2026 20:16
@theory theory self-assigned this Aug 28, 2026
I noticed that timestamptz values weren't exported with time zone
information, which is necessary to ensure proper round-tripping.

Add the `date_time_output_format='iso'` setting to each chDB query to
always format `timestamp` and `timestamptz` values in plain text formats
with the ISO-8601 format in UTC.

Remove setting the `datestyle` and `timezone` GUCs to hard-coded
constants, instead allowing them to be respected. Or at least, we
respect the `timezone` GUC for converting `timestamp` values, but always
emit UTC for both timestamp and timestamptz, since that's all that
`date_time_output_format='iso'` supports.

Add a new test file, `test/sql/timestamp.sql` to test the impact of the
new setting on plain-text output, as well as the impact of the
`timezone` setting on `timestamp` values. Interestingly, setting a time
zone in the structure, e.g. `DateTime64(3, 'Japan')`, has no impact on
exported values.

Add the "Timestamp Conversion" section to the chdb_hook docs to document
these behaviors.

In passing, change the `real` columns in `test/qa/taxi.sql` to `double
precision`, since the source defines the values as `Float64`.
@theory
theory merged commit f4cbc98 into main Aug 28, 2026
18 checks passed
@theory
theory deleted the timestamp-format branch August 28, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants