fix(unparser): use to_rfc3339 for default TIMESTAMPTZ formatting#21295
Open
sgrebnov wants to merge 1 commit intoapache:mainfrom
Open
fix(unparser): use to_rfc3339 for default TIMESTAMPTZ formatting#21295sgrebnov wants to merge 1 commit intoapache:mainfrom
sgrebnov wants to merge 1 commit intoapache:mainfrom
Conversation
Contributor
|
Seems solid, waiting for someone else to take another look |
AndreaBozzo
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
to_rfc3339forTIMESTAMPTZformatting #21294.Rationale for this change
The default
timestamp_with_tz_to_stringusesDateTime<Tz>.to_string(), which produces literals like2025-09-15 11:00:00 +00:00that are not supported by multiple dialects (e.g. DuckDB, BigQuery). Switching toto_rfc3339()produces valid ISO 8601 / RFC 3339 strings (e.g.2025-09-15T11:00:00+00:00) that are broadly compatible.What changes are included in this PR?
Dialect::timestamp_with_tz_to_stringimplementation fromdt.to_string()todt.to_rfc3339()timestamp_with_tz_to_stringoverrides fromDuckDBDialectandBigQueryDialect(they produced equivalent RFC 3339-compatible output via custom format strings)Are these changes tested?
Yes, existing tests in
unparser::expr::testshave been updated to reflect the new format.Manually verifying updated format supported by
PostgreSQL,MySQL,SQLite,DuckDBandBigQuery.Are there any user-facing changes?
Yes — timestamp-with-timezone literals are now formatted as RFC 3339 (
2025-09-15T11:00:00+00:00) instead of the previousDisplayformat (2025-09-15 11:00:00 +00:00). Dialects that need a different format can still overridetimestamp_with_tz_to_string.