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 CAJTYsWUJFHhqiGD+6vw6m0ELqjajoKev2UutFUMB2uQDjm6+TA@mail.gmail.com
Whole thread
In response to Re: to_date()/to_timestamp() silently accept month=0 and day=0  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: to_date()/to_timestamp() silently accept month=0 and day=0
List pgsql-bugs
Hi,

On Thu, 23 Apr 2026 at 21:10, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Looking at the code, I think it intentionally interprets zero as
"missing data".  See for example the stanza at formatting.c:4650ff
where tm_mon and tm_mday can be backfilled from a DDD field.

I'm disinclined to change the behavior around this; you're far
more likely to get complaints than kudos.


If we are not going to change the behaviour, imo, we should
atleast add a test case to depict this scenario and comment
that says this is expected behaviour according to the community. 

Regards,
Ayush

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: to_date()/to_timestamp() silently accept month=0 and day=0
Next
From: Andrey Borodin
Date:
Subject: Re: BUG #19458: OOM killer in jsonb_path_exists_opr (@?) with malformed JSONPath containing non-existent variables