public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ayush Tiwari <[email protected]>
To: Tom Lane <[email protected]>
Cc: Daniel Gustafsson <[email protected]>
Cc: Michael Paquier <[email protected]>
Cc: [email protected]
Subject: Re: to_date()/to_timestamp() silently accept month=0 and day=0
Date: Thu, 23 Apr 2026 22:06:41 +0530
Message-ID: <CAJTYsWUJFHhqiGD+6vw6m0ELqjajoKev2UutFUMB2uQDjm6+TA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAJTYsWWNfF+hMpbsTDF8NMr+AuqoDfNxR=oHUZm7xqGP+dJ9rA@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>

Hi,

On Thu, 23 Apr 2026 at 21:10, Tom Lane <[email protected]> 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


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: to_date()/to_timestamp() silently accept month=0 and day=0
  In-Reply-To: <CAJTYsWUJFHhqiGD+6vw6m0ELqjajoKev2UutFUMB2uQDjm6+TA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox