Commit 5b0938d
authored
fix(unparser): use to_rfc3339 for default TIMESTAMPTZ formatting (#21295)
## Which issue does this PR close?
- Closes #21294.
## Rationale for this change
The default `timestamp_with_tz_to_string` uses
`DateTime<Tz>.to_string()`, which produces literals like `2025-09-15
11:00:00 +00:00` that are not supported by multiple dialects (e.g.
DuckDB, BigQuery). Switching to `to_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?
- Changed the default `Dialect::timestamp_with_tz_to_string`
implementation from `dt.to_string()` to `dt.to_rfc3339()`
- Removed now-redundant `timestamp_with_tz_to_string` overrides from
`DuckDBDialect` and `BigQueryDialect` (they produced equivalent RFC
3339-compatible output via custom format strings)
- Updated test expectations to match the new default format
## Are these changes tested?
Yes, existing tests in `unparser::expr::tests` have been updated to
reflect the new format.
Manually verifying updated format supported by `PostgreSQL`, `MySQL`,
`SQLite`, `DuckDB` and `BigQuery`.
## 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 previous `Display` format
(`2025-09-15 11:00:00 +00:00`). Dialects that need a different format
can still override `timestamp_with_tz_to_string`.1 parent 1e93a67 commit 5b0938d
2 files changed
Lines changed: 17 additions & 41 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
| 219 | + | |
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| |||
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | 492 | | |
504 | 493 | | |
505 | 494 | | |
| |||
656 | 645 | | |
657 | 646 | | |
658 | 647 | | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | 648 | | |
672 | 649 | | |
673 | 650 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2047 | 2047 | | |
2048 | 2048 | | |
2049 | 2049 | | |
2050 | | - | |
| 2050 | + | |
2051 | 2051 | | |
2052 | 2052 | | |
2053 | 2053 | | |
| |||
2058 | 2058 | | |
2059 | 2059 | | |
2060 | 2060 | | |
2061 | | - | |
| 2061 | + | |
2062 | 2062 | | |
2063 | 2063 | | |
2064 | 2064 | | |
| |||
2069 | 2069 | | |
2070 | 2070 | | |
2071 | 2071 | | |
2072 | | - | |
| 2072 | + | |
2073 | 2073 | | |
2074 | 2074 | | |
2075 | 2075 | | |
| |||
2080 | 2080 | | |
2081 | 2081 | | |
2082 | 2082 | | |
2083 | | - | |
| 2083 | + | |
2084 | 2084 | | |
2085 | 2085 | | |
2086 | 2086 | | |
| |||
3374 | 3374 | | |
3375 | 3375 | | |
3376 | 3376 | | |
3377 | | - | |
| 3377 | + | |
3378 | 3378 | | |
3379 | 3379 | | |
3380 | 3380 | | |
3381 | 3381 | | |
3382 | 3382 | | |
3383 | 3383 | | |
3384 | 3384 | | |
3385 | | - | |
| 3385 | + | |
3386 | 3386 | | |
3387 | 3387 | | |
3388 | 3388 | | |
3389 | 3389 | | |
3390 | 3390 | | |
3391 | 3391 | | |
3392 | 3392 | | |
3393 | | - | |
| 3393 | + | |
3394 | 3394 | | |
3395 | 3395 | | |
3396 | 3396 | | |
3397 | 3397 | | |
3398 | 3398 | | |
3399 | 3399 | | |
3400 | 3400 | | |
3401 | | - | |
| 3401 | + | |
3402 | 3402 | | |
3403 | 3403 | | |
3404 | 3404 | | |
3405 | 3405 | | |
3406 | | - | |
| 3406 | + | |
3407 | 3407 | | |
3408 | 3408 | | |
3409 | 3409 | | |
3410 | 3410 | | |
3411 | 3411 | | |
3412 | 3412 | | |
3413 | 3413 | | |
3414 | | - | |
| 3414 | + | |
3415 | 3415 | | |
3416 | 3416 | | |
3417 | 3417 | | |
3418 | 3418 | | |
3419 | 3419 | | |
3420 | 3420 | | |
3421 | 3421 | | |
3422 | | - | |
| 3422 | + | |
3423 | 3423 | | |
3424 | 3424 | | |
3425 | 3425 | | |
3426 | 3426 | | |
3427 | 3427 | | |
3428 | 3428 | | |
3429 | 3429 | | |
3430 | | - | |
| 3430 | + | |
3431 | 3431 | | |
3432 | | - | |
3433 | 3432 | | |
3434 | 3433 | | |
3435 | 3434 | | |
3436 | | - | |
| 3435 | + | |
3437 | 3436 | | |
3438 | 3437 | | |
3439 | 3438 | | |
3440 | 3439 | | |
3441 | 3440 | | |
3442 | 3441 | | |
3443 | 3442 | | |
3444 | | - | |
| 3443 | + | |
3445 | 3444 | | |
3446 | 3445 | | |
3447 | 3446 | | |
3448 | 3447 | | |
3449 | 3448 | | |
3450 | 3449 | | |
3451 | 3450 | | |
3452 | | - | |
| 3451 | + | |
3453 | 3452 | | |
3454 | 3453 | | |
3455 | 3454 | | |
3456 | 3455 | | |
3457 | 3456 | | |
3458 | 3457 | | |
3459 | 3458 | | |
3460 | | - | |
| 3459 | + | |
3461 | 3460 | | |
3462 | 3461 | | |
3463 | 3462 | | |
| |||
0 commit comments