Re: to_date()/to_timestamp() silently accept month=0 and day=0 - Mailing list pgsql-bugs

From Ayush Tiwari
Subject Re: to_date()/to_timestamp() silently accept month=0 and day=0
Date
Msg-id CAJTYsWXC8VbipX=MJ8e2zdSZ5oKck-MuVX-6qK0cAv6Z3sDm9Q@mail.gmail.com
Whole thread
In response to Re: to_date()/to_timestamp() silently accept month=0 and day=0  (Michael Paquier <michael@paquier.xyz>)
List pgsql-bugs
Hi,

On Mon, 27 Apr 2026 at 12:53, Michael Paquier <michael@paquier.xyz> wrote:
On Fri, Apr 24, 2026 at 02:44:04PM +0200, Daniel Gustafsson wrote:
> LGTM for the most part, I don't really think we need to use both to_date and
> to_timestamp though, we can save a few cycles there.  I rewrote the comments to
> match the rest of the file, and moved to where to where we test for year 0000
> since it seems like a better place.  Also took the liberty to use year 100 in
> one of the testcase, while the year is superfluous for the test in question,
> year 100 was previously untested so this will increase test coverage for free.

That seems fine to me.  If we decide to change this behavior later on
and error on these pattern, at least we'll know about them.

+1.

(Just one tiny nit for whenever this gets committed: in the v2 inline comment,
"0 -> 1'st" might be slightly cleaner as "0 -> 1st" or "0 -> 1").

Regards,
Ayush 

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #19469: Prevent SIGSEGV on FETCH after ALTER TYPE of cursor rowtype
Next
From: Ayush Tiwari
Date:
Subject: Re: BUG #19468: Prevent SIGSEGV on FETCH after ALTER TYPE of cursor rowtype