Repository navigation
fix(postgres)!: map ISO week format patterns IYYY and IW [CLAUDE] - #8672
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
georgesittas
approved these changes
Oct 19, 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.
Postgres'
TIME_MAPPINGhas no entries for the ISO 8601 patternsIYYY(week-numbering year) andIW(ISO week), so the format trie splitsIYYYintoI+YYYand leavesIWuntouched. The output is a format string that no target understands, and the reverse direction leaks%G/%VintoTO_CHAR. This adds both patterns (upper and lower case, like the existingww/WW) mapped to%Gand%V, matching what Exasol already does.I checked the results on PostgreSQL 17.11 and DuckDB 1.5.6: for 2021-01-01, 2024-12-30 and 2023-01-01,
TO_CHAR(d, 'IYYY-IW')andSTRFTIME(d, '%G-%V')both return2020-53,2025-01and2022-52. Before the fix, DuckDB returnedI2021three-IWfor the first date. Docs: https://www.postgresql.org/docs/current/functions-formatting.html (Redshift, which inherits this mapping, documents the same patterns: https://docs.aws.amazon.com/redshift/latest/dg/r_FORMAT_strings.html). The newvalidate_allcase is intests/dialects/test_postgres.py.Developed with Claude Code (AI) under my direction; tests and
make checkpass locally.