Re: to_date()/to_timestamp() silently accept month=0 and day=0

From: 张鹏超 <zhangpengchao(at)highgo(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: to_date()/to_timestamp() silently accept month=0 and day=0
Date: 2026-08-03 08:59:02
Message-ID: 6bd72b08.3f4.19fc6d913b7.Coremail.zhangpengchao@highgo.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2026-04-22, Ayush Tiwari wrote:
> Inputs with month = 00 or day = 00 are accepted silently and normalized
> to January / day 1, instead of being rejected as out of range.

I tested the v2 patch[1] on current master (CentOS Stream 9, x86_64):

- make check: All 245 tests passed, no regressions.
- Manually verified the zero month/day behavior matches expected
output in the patch. Out-of-range values still error correctly.

The new regression tests document this long-standing behavior cleanly.
No issues found.

As a new reviewer, I'd appreciate any feedback on my review approach.

[1] https://www.postgresql.org/message-id/attachment/195491/v2-0001-Add-regression-tests-for-zero-month-day-handling-.patchRegards,zpc

Browse pgsql-hackers by date

  From Date Subject
Next Message Bohyun Lee 2026-08-03 09:01:12 Re: [Patch]The Case For WAL-Logging pg_upgrade
Previous Message Chao Li 2026-08-03 08:49:48 Fix NO_OOM handling in MemoryContextAllocAligned