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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: to_date()/to_timestamp() silently accept month=0 and day=0
Date: 2026-04-27 07:23:01
Message-ID: ae8O1YKVbykFGcsM@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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.
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2026-04-27 09:48:53 BUG #19468: Prevent SIGSEGV on FETCH after ALTER TYPE of cursor rowtype
Previous Message PG Bug reporting form 2026-04-27 06:44:56 BUG #19467: Inconsistency in MOD() result involving POWER() and floating-point precision in PostgreSQL