Re: BUG #19367: typos in backend/utils/adt/timestamp.c
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Japin Li <japinli@hotmail.com>
Cc: Rahila Syed <rahilasyed90@gmail.com>, fadeymail@rambler.ru,
pgsql-bugs@lists.postgresql.org
Date: 2025-12-29T15:37:39Z
Lists: pgsql-bugs
Japin Li <japinli@hotmail.com> writes: > On Mon, 29 Dec 2025 at 15:55, Rahila Syed <rahilasyed90@gmail.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