repr: Honor DateStyle MDY and two-digit-year windowing in date parsing#37838
Merged
Conversation
Interpret separated all-numeric date literals the way PostgreSQL does
under the pinned DateStyle 'ISO, MDY': a one- or two-digit leading
field starts a month-day-year date, and a two-digit year is windowed
into 1970..=2069. A leading field of three or more digits keeps the
year-month-day interpretation. This applies to date, timestamp and
timestamptz parsing at the SQL layer.
SELECT date '01/02/03'; -- now 2003-01-02, was 0001-02-03
SELECT date '99-01-08'; -- now an error (month 99), was 0099-01-08
Storage source casts stay on new frozen legacy parse functions
(parse_date_legacy and friends) so their evaluation is unchanged, per
the stability contract in mz_storage_types::sources::casts.
Closes: SQL-461
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
antiguru
approved these changes
Jul 24, 2026
def-
added a commit
to def-/materialize
that referenced
this pull request
Jul 24, 2026
def-
added a commit
to def-/materialize
that referenced
this pull request
Jul 24, 2026
def-
added a commit
to def-/materialize
that referenced
this pull request
Jul 24, 2026
MaterializeInc#37838) Interpret separated all-numeric date literals the way PostgreSQL does under the pinned DateStyle 'ISO, MDY': a one- or two-digit leading field starts a month-day-year date, and a two-digit year is windowed into 1970..=2069. A leading field of three or more digits keeps the year-month-day interpretation. This applies to date, timestamp and timestamptz parsing at the SQL layer. SELECT date '01/02/03'; -- now 2003-01-02, was 0001-02-03 SELECT date '99-01-08'; -- now an error (month 99), was 0099-01-08 Storage source casts stay on new frozen legacy parse functions (parse_date_legacy and friends) so their evaluation is unchanged, per the stability contract in mz_storage_types::sources::casts. Closes: SQL-461 Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
def-
added a commit
to def-/materialize
that referenced
this pull request
Jul 24, 2026
def-
added a commit
that referenced
this pull request
Jul 24, 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.
Interpret separated all-numeric date literals the way PostgreSQL does under the pinned DateStyle 'ISO, MDY': a one- or two-digit leading field starts a month-day-year date, and a two-digit year is windowed into 1970..=2069. A leading field of three or more digits keeps the year-month-day interpretation. This applies to date, timestamp and timestamptz parsing at the SQL layer.
Storage source casts stay on new frozen legacy parse functions (parse_date_legacy and friends) so their evaluation is unchanged, per the stability contract in mz_storage_types::sources::casts.
Closes: SQL-461