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 1wHJcI-0073OG-2n for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Apr 2026 10:55:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wHJcH-00DaMF-0n for pgsql-bugs@arkaria.postgresql.org; Mon, 27 Apr 2026 10:55:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wHJcG-00DaM7-3B for pgsql-bugs@lists.postgresql.org; Mon, 27 Apr 2026 10:55:04 +0000 Received: from mail-yw1-x1136.google.com ([2607:f8b0:4864:20::1136]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wHJcE-00000003K1i-4Bjo for pgsql-bugs@lists.postgresql.org; Mon, 27 Apr 2026 10:55:04 +0000 Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-79a46260385so112584157b3.3 for ; Mon, 27 Apr 2026 03:55:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1777287300; cv=none; d=google.com; s=arc-20240605; b=kUydrAgJaRvVPjEsutbU56iZGwWxOEZ17n9GwcDHj4oNYuI9UM5hnNR0lJaZLbf001 u0Py0Wrb84qC8K7OQHGWVhSfGZui1z46j6xjWTn7/B8aMO9ngM7uvSjWBscuKOJ1Af8t vu3kyzaajLvJ9QguNLxIxmC0zpVGkdm4fRtBlPV6JC/SDeIsiKYvl4RSaIPHW0CUdaro Z/23qZSdWbOoWCuPXkHH5SA870sQ32iz68fFUuSsKkvRtRUS7LHavJT+p/mYnZXMf3Ph cnc27I7n1GXSUeRHqxQHDZCr8iMTAwtgCCTumgzbaLkMUoJmJ/JfgYMWzC3jsKsACFKc +RSg== 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=fNpxsLHfIMRzv3GSzfet2mNs/eEzifpilTco7RO+L4g=; fh=oPgV4sDw/XHrTW6EaYWqmdbdSXSsXNWiMdkguEZ8G2w=; b=UObqRj1RGuV967MUn1HQeIiRO2FhFA2iu/OOdTDYGGWkqgjNXI9yTKcxcyWRYm5/xh kd/rvKSt6IQH3Equs4ZUWfipuGszm9CRt8DU/3iLM9Gbwk0U5N7ZLZ9d9URNBKC5d1kR oGUCYbzICzf/tPqI6nfBOXmWw8rIbrR8xcxABi537cY5GuNJaJuCe90LlxEjEFhtaeja DsmWjVltMQUJXE9doegBOwBIoNqrZGWn50lvRs1oLsm/jA2wx7V1scuOqeeRWBMjkNgb DV7eIPRLybnhOBa9ezKjgKMib9TAR1IiXkY16y1TegezPJ/5mnv++2PxmxLNwDO7BTEP PhAg==; 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=1777287300; x=1777892100; 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=fNpxsLHfIMRzv3GSzfet2mNs/eEzifpilTco7RO+L4g=; b=B2/fj2za170ivA7kQb1yICPwk2UzxNWvlvLdQxh+fd8UgbuyKcBhRBhTFXymf4f2rk t4BUj2ALFgkYBCnAk78yECKz4Hij04j99/Wvt2OnEA0/F7EgEQWVPLzJ6WB/6GMWkTdu ssQ9M3wBM7nM9CMXx9Tg8uTfZzSH8/6CyYzRjPYU0YH64+nSIxP4RUW5OMErDeYO9Pfo ttgG6VAWiw6amA9NeIyjn+jWC6toskow23ZcSU2d9n9MYcSpQHVphWbQl0CT1TJWmx8B W9K1lmGpSO6HCxcKvSE5u5hTbnOaOUkIbV6pQl3PFjmce7H8PaqO05BeSFTQjNfWgVBm aXYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777287300; x=1777892100; 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=fNpxsLHfIMRzv3GSzfet2mNs/eEzifpilTco7RO+L4g=; b=YjaQTyS7+WZRzPYvXmIltMz10SgQcKajes1PDiYduaOlvs4XWb7cqzOYju5fN0Pdpc 3e6z3zGuixdhlnwkObawurseJpkmHfZVWkbJGmFoPLyxEKax7JeCFPgqzTykStWXs+6l f7Ezyh9lMBAAce3v4ci2Fiu8py8y0aqj+A/F1WktloWitZrtgTKoXoxQusSWUQhoP5uO IIW9WXem7mbOm3yuo0fu0xEVQ3DdMTHTBJIAYeuUw/nz2bkFmRGCCTLsGNablcKfB8fm s+ZlA+CxJ/6hvuvmYLkDnzffwEm1mAcsLN2R77VNcqp1oGPXsufQbyRJphs6jfjzCrax /TBg== X-Forwarded-Encrypted: i=1; AFNElJ9MAWY8SUdeV86oN1h1okSvZRBHilj2HS7OzkDguVvfFUKTaMW5VdHOjLfnSaaGsdtBr0zvmm8Xep0K@lists.postgresql.org X-Gm-Message-State: AOJu0YzRFyPzREJwSJgQDEnCxITVpss1UmuiJ5EXmKJk0OFfcDlNlfTO s6fSZe4BT5rHVwisw0x3a3r6Bd/5RBrJYvGg8vcWoidqYB/dG03IrYR/Z4scH7zEVOIQu1wbMIf 015q24FgZaPrZGvBCJmOYi/QYy0F+Sqs= X-Gm-Gg: AeBDietqzfGJYnbjlSBfNq1MFsRsYbdSyayEL3nYXL+q0q/BbHfqOy6GBs9azHDeRKd GR371G+lB1kBE8tLjcYbDAxt109TpCUaJ8ZlafQM1XC/G8ndQRr3RzkYlRtY52fTYyriqofFjW5 FNvHj68RbbHuSI1EMsAWleSHuYAdjHzhwbMVn4NHewLtwyjQOfx1lkMyM46YDZ9060+k6XTAZFq XP+jfPk8HxqxKYlYt7Wwd8l51K1u7n8IJrjhu48DwQkzgUySA0FdVm8nA5nC2qYekwe4h99rvt9 rhqTD+0XOQ3AHfKR/hFmk54Ud3IaVV0XchsdyeisXiT//wdEjErU+zLGi2Tv X-Received: by 2002:a05:690c:6d83:b0:79a:c659:6756 with SMTP id 00721157ae682-7b9eceeb2c7mr409987707b3.21.1777287300073; Mon, 27 Apr 2026 03:55:00 -0700 (PDT) MIME-Version: 1.0 References: <1444609.1776958814@sss.pgh.pa.us> <1B595919-2596-4CB3-BC39-DDCCB9876E56@yesql.se> In-Reply-To: From: Ayush Tiwari Date: Mon, 27 Apr 2026 16:24:55 +0530 X-Gm-Features: AVHnY4JR9H_cscINNvQxT8IohJJ9X85woibuAs7Ys6fbUUuDwf8pg7jbFnU0_6g Message-ID: Subject: Re: to_date()/to_timestamp() silently accept month=0 and day=0 To: Michael Paquier Cc: Daniel Gustafsson , Tom Lane , pgsql-bugs@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000002f4abe06506ef238" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000002f4abe06506ef238 Content-Type: text/plain; charset="UTF-8" Hi, On Mon, 27 Apr 2026 at 12:53, Michael Paquier 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 --0000000000002f4abe06506ef238 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

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

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

+1.

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

Re= gards,
Ayush=C2=A0
--0000000000002f4abe06506ef238--