Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wFx3u-005jp9-0E for pgsql-bugs@arkaria.postgresql.org; Thu, 23 Apr 2026 16:37:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wFx2u-002USv-0U for pgsql-bugs@arkaria.postgresql.org; Thu, 23 Apr 2026 16:36:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wFx2t-002USi-2s for pgsql-bugs@lists.postgresql.org; Thu, 23 Apr 2026 16:36:55 +0000 Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wFx2r-00000002RZ8-3TKg for pgsql-bugs@lists.postgresql.org; Thu, 23 Apr 2026 16:36:55 +0000 Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-7b23713eac9so67957547b3.2 for ; Thu, 23 Apr 2026 09:36:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776962213; cv=none; d=google.com; s=arc-20240605; b=gLWi899PWGyJDh7x8atVMgjk/RNqfWae8n6U/O5nWTO8mn7ejN6KMxMwZ+j8Fp59LY vc0GlYDN1yRJOwhmskbEUaLUdTN4ob5gghz1PyI/5Vr2P3586n7g8KcZdxOO7tpzxKkh 7vqclpA6kHO+U+CLaNoAJTm2FrrJ8lol5P97jiYudnIQ30c2h+HhZbXlQ/F7w2VpkEC5 Aa4GKJ3IOJp64fW1slmOug7qMfdG6crv2kkGpnqrUEU/c/1rHncxuzIQ80E22M2b8vvV sNo8/WVKXpgutvAp5Eh5HvCvCYCc8FjZA4L1qEA/KgAJlMt1BJqCiqD7QjwERwpEPFfu j6rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=pGKsoavUOxIxERSV7UscPxRxEJRzDhZlQG25E1l9ywY=; fh=dOmQ8yS+Bb+j0bSs9dOU8xjIoBd+JmCmM826FESI+Hs=; b=AimuQe4m38BQ9TMmSZgeXm7++PJ7m/q5naWUlQ4mPmYGKj/9Jk1yU+Ey8CGWSBKTTV JptcIfkYBG43FfuGCwQRnSbBsSIL6i+Wg1QUcp/m6d8hmyTsNAhNjgqITJwr4OT4GLVk QWLdhqFmilB1YJdMbaSbNmSwX2A1RJLOchNLZL/pZJxeNLtFnMFz6BuZ0i3D2Uwb29N+ 3g7BvDLh74NS42kxb2bNwMA+gXH1ngLxDfk6x/6J/C2hDpVastLugEU7dnX4CuGIEB2n pwaloAwRk6kU/wu4Cm2E8voHkNRgqtLrly+QwZdCLVftuEGukXTMgwUVgy98zRGanxlO NV7g==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776962213; x=1777567013; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=pGKsoavUOxIxERSV7UscPxRxEJRzDhZlQG25E1l9ywY=; b=Wu1wuMzE7ErafWwXqBvaLHrSj7kOZiRkjlVUV4oGjorsw+J69nx7yc2oryvYK9b1iM SeBmM+CBXUIO7Yi2fpwlODLnsXNTTtfMCxqI05m3GS6WOqlGw/He29wf8H+GtU9HTUB3 QX76Pk1rsmlZk3CsY8fEvtogoPzLmAi7/D7JrOBpza3DmztlLMueUde9sMWWnzUFufF6 RXQMLdbEWAqYYWP/JpAp59QnlKOTV45+UdBnZf4snvtAUT2G+wimcwO8MuBbpFoc/vNB /eOjJwUFewDe4vUFHScA279xqUNLB0hEg9o/P84rrXZb0GrAjl+f6nXceOWuzIinZGV3 Q8Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776962213; x=1777567013; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pGKsoavUOxIxERSV7UscPxRxEJRzDhZlQG25E1l9ywY=; b=EmOBOdRaLkpIn/RRfhNwRt/oDNfbN3GeNEngfdvqT4oa3xa5IV8QUFdEtMznSu4Lj0 2dO4TuWhrygQk8wsTmYqnEzPG8KU6ASeDTSFWY44bQ4gMbkvckX5RkAFJ+Tf97pIYIOb awQqa4q6saDOr5csnYh6wEKR/z3vA2G7oL4/mdtrGiT8frN0oCO4v6boBM9fX8e/OGvE 2XjPzBX7gEWsa0uspohFR/oD8nZ0lqKAnQV96wXzf6dv0yp6R9l2C+2LlwnpOAIFVZbi HHd0s1eVYgNf/5C8rv2jHximCmnFm6kqKXPORVdAgZtZ6/r4+mJd/nDcmfmeEp8CVyCW 5+IQ== X-Forwarded-Encrypted: i=1; AFNElJ/7MQoV/4G9toDK1KYrBnsKLiZdIDND7Ce9b76DH8oOC0xqELFbELT6DN8FZU6o06yhykwMAedcNzF4@lists.postgresql.org X-Gm-Message-State: AOJu0YzUte+tcOpkieKSwsOiGHvCRTD8web5q+yk1f6Qv+Vf9wabZ45m PTCARKayCv8i2gAT2Ghep5U6O1VVavmoesloAZJDZs3JN5z8hS5pM4wRYwySssaTv0SIvWbZHZF kvfvoyyK+RxHXhMhd4gyneIsFUApwIFc= X-Gm-Gg: AeBDiesWYvqVaZdbfFLEgbG0IBEk0sWqdq3k0oAWWYy/60oG6qLXj+znMAo9Q5ECr7u stKu79eem0u+K8oeLXwkLryn1s06NZA2ee/xznHkhAVxa01HrVxxEnTiEOnW7myX0nCkTFqH+H5 4UvqaMBG4UU9/ndRCThZ7sKqn166F0L8Z7SHsg95NnhQGHFvU+iOyrxtwIaRQE3eZCbe3AmzEzM HtBxfYU9YjJwuPltOz4Rvn9+MoZdvjqHQRBfFYD0Ef5+Rtr5vrNfINdd+AhkC8vJT4H7StppywV IBQwrTzudBczN3JKPey0R/3bk8mmvZVTALG+K9XqK8zMCeC4 X-Received: by 2002:a05:690c:698a:b0:7a2:1f26:3d5f with SMTP id 00721157ae682-7b9ecf79bb4mr293709977b3.28.1776962213179; Thu, 23 Apr 2026 09:36:53 -0700 (PDT) MIME-Version: 1.0 References: <1444609.1776958814@sss.pgh.pa.us> In-Reply-To: <1444609.1776958814@sss.pgh.pa.us> From: Ayush Tiwari Date: Thu, 23 Apr 2026 22:06:41 +0530 X-Gm-Features: AQROBzCaehjfguclsFnCOHf8aHqpXTLpzpq8nPBqwsZ61SURp-VqXDEQh-15OvY Message-ID: Subject: Re: to_date()/to_timestamp() silently accept month=0 and day=0 To: Tom Lane Cc: Daniel Gustafsson , Michael Paquier , pgsql-bugs@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000007ef638065023410c" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000007ef638065023410c Content-Type: text/plain; charset="UTF-8" Hi, On Thu, 23 Apr 2026 at 21:10, Tom Lane 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 --0000000000007ef638065023410c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

On Thu, 23 Apr 2026 at 21:10= , Tom Lane <tgl@sss.pgh.pa.us&g= t; wrote:

Looking at the code, I think it intentionally interprets zero as
"missing data".=C2=A0 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=C2=A0add a test case to depict this scenario and comment
that says this is expected behaviour according to the community.=C2=A0

Regards,
Ayush
--0000000000007ef638065023410c--