Re: BUG #19367: typos in backend/utils/adt/timestamp.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Japin Li <japinli(at)hotmail(dot)com>
Cc: Rahila Syed <rahilasyed90(at)gmail(dot)com>, fadeymail(at)rambler(dot)ru, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19367: typos in backend/utils/adt/timestamp.c
Date: 2025-12-29 15:37:39
Message-ID: 2867662.1767022659@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Japin Li <japinli(at)hotmail(dot)com> writes:
> On Mon, 29 Dec 2025 at 15:55, Rahila Syed <rahilasyed90(at)gmail(dot)com> wrote:
>>> There are typos in return type of these functions:

>> You’re right — these are just typos, and they don’t affect correctness since both
>> ultimately call Int64GetDatum().
>> Still, +1 for fixing them for clarity.

> The functions timestamptz_pl_interval() and timestamptz_mi_interval() have 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-12-29 17:28:07 Re: BUG #19365: postgres 18 pg_dump fails whan drop sequence concurrently
Previous Message Николай Фадеев 2025-12-29 12:20:53 RE: BUG #19367: typos in backend/utils/adt/timestamp.c