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 1vaFJg-005lul-03 for pgsql-bugs@arkaria.postgresql.org; Mon, 29 Dec 2025 15:37:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vaFJd-00H7oS-2Y for pgsql-bugs@arkaria.postgresql.org; Mon, 29 Dec 2025 15:37:50 +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 1vaFJd-00H7oK-1j for pgsql-bugs@lists.postgresql.org; Mon, 29 Dec 2025 15:37:50 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vaFJb-003Q2J-2u for pgsql-bugs@lists.postgresql.org; Mon, 29 Dec 2025 15:37:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 5BTFbdKM2867663; Mon, 29 Dec 2025 10:37:39 -0500 From: Tom Lane To: Japin Li cc: Rahila Syed , fadeymail@rambler.ru, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19367: typos in backend/utils/adt/timestamp.c In-reply-to: References: <19367-16750e0343aaea77@postgresql.org> Comments: In-reply-to Japin Li message dated "Mon, 29 Dec 2025 18:35:29 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2867661.1767022659.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 29 Dec 2025 10:37:39 -0500 Message-ID: <2867662.1767022659@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Japin Li writes: > On Mon, 29 Dec 2025 at 15:55, Rahila Syed wrote= : >>> There are typos in return type of these functions: >> You=E2=80=99re right =E2=80=94 these are just typos, and they don=E2=80= =99t affect correctness since both = >> ultimately call Int64GetDatum(). = >> Still, +1 for fixing them for clarity. > The functions timestamptz_pl_interval() and timestamptz_mi_interval() ha= ve the > same typos, right? My recollection is that this code deliberately fuzzes the difference between timestamp and timestamptz in many places. An example is that timestamp_eq and its sibling comparison functions are used as-is for both timestamp and timestamptz --- note the comment in front of timestamp_cmp_internal in timestamp.c. (BTW, "thomas" there is Lockhart not me.) So I think that being cavalier about PG_RETURN_TIMESTAMP versus PG_RETURN_TIMESTAMPTZ stems from that; in fact, if you go back far enough in our git history you will find we didn't even have the latter to begin with. There may be places where we can clean this up and not simply be reversing the direction in which we're type-punning, but I doubt we'll be able to fix every one without duplicating functions. So I can't get hugely excited about it. regards, tom lane