pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #19367: typos in backend/utils/adt/timestamp.c
6+ messages / 5 participants
[nested] [flat]
* BUG #19367: typos in backend/utils/adt/timestamp.c
@ 2025-12-29 09:13 PG Bug reporting form <noreply@postgresql.org>
2025-12-29 10:25 ` Re: BUG #19367: typos in backend/utils/adt/timestamp.c Rahila Syed <rahilasyed90@gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: PG Bug reporting form @ 2025-12-29 09:13 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: fadeymail@rambler.ru
The following bug has been logged on the website:
Bug reference: 19367
Logged by: Nikolay Fadeev
Email address: fadeymail@rambler.ru
PostgreSQL version: 18.1
Operating system: all OS
Description:
There are typos in return type of these functions:
1) timestamptz_pl_interval_at_zone(PG_FUNCTION_ARGS)
NOW: PG_RETURN_TIMESTAMP(timestamptz_pl_interval_internal(timestamp,
span, attimezone));
SHOULD:
PG_RETURN_TIMESTAMPTZ(timestamptz_pl_interval_internal(timestamp, span,
attimezone));
2) Datum timestamptz_mi_interval_at_zone(PG_FUNCTION_ARGS)
NOW: PG_RETURN_TIMESTAMP(timestamptz_mi_interval_internal(timestamp,
span, attimezone));
SHOULD:
PG_RETURN_TIMESTAMPTZ(timestamptz_mi_interval_internal(timestamp, span,
attimezone));
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: BUG #19367: typos in backend/utils/adt/timestamp.c
2025-12-29 09:13 BUG #19367: typos in backend/utils/adt/timestamp.c PG Bug reporting form <noreply@postgresql.org>
@ 2025-12-29 10:25 ` Rahila Syed <rahilasyed90@gmail.com>
2025-12-29 10:35 ` Re: BUG #19367: typos in backend/utils/adt/timestamp.c Japin Li <japinli@hotmail.com>
2025-12-29 12:20 ` RE: BUG #19367: typos in backend/utils/adt/timestamp.c =?UTF-8?b?0J3QuNC60L7Qu9Cw0Lkg0KTQsNC00LXQtdCy?= <fadeymail@rambler.ru>
0 siblings, 2 replies; 6+ messages in thread
From: Rahila Syed @ 2025-12-29 10:25 UTC (permalink / raw)
To: fadeymail@rambler.ru; pgsql-bugs@lists.postgresql.org
Hi,
There are typos in return type of these functions:
> 1) timestamptz_pl_interval_at_zone(PG_FUNCTION_ARGS)
> NOW: PG_RETURN_TIMESTAMP(timestamptz_pl_interval_internal(timestamp,
> span, attimezone));
> SHOULD:
> PG_RETURN_TIMESTAMPTZ(timestamptz_pl_interval_internal(timestamp, span,
> attimezone));
> 2) Datum timestamptz_mi_interval_at_zone(PG_FUNCTION_ARGS)
> NOW: PG_RETURN_TIMESTAMP(timestamptz_mi_interval_internal(timestamp,
> span, attimezone));
> SHOULD:
> PG_RETURN_TIMESTAMPTZ(timestamptz_mi_interval_internal(timestamp, span,
> attimezone));
>
>
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.
Thank you,
Rahila Syed
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: BUG #19367: typos in backend/utils/adt/timestamp.c
2025-12-29 09:13 BUG #19367: typos in backend/utils/adt/timestamp.c PG Bug reporting form <noreply@postgresql.org>
2025-12-29 10:25 ` Re: BUG #19367: typos in backend/utils/adt/timestamp.c Rahila Syed <rahilasyed90@gmail.com>
@ 2025-12-29 10:35 ` Japin Li <japinli@hotmail.com>
2025-12-29 15:37 ` Re: BUG #19367: typos in backend/utils/adt/timestamp.c Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 1 reply; 6+ messages in thread
From: Japin Li @ 2025-12-29 10:35 UTC (permalink / raw)
To: Rahila Syed <rahilasyed90@gmail.com>; +Cc: fadeymail@rambler.ru; pgsql-bugs@lists.postgresql.org
On Mon, 29 Dec 2025 at 15:55, Rahila Syed <rahilasyed90@gmail.com> wrote:
> Hi,
>
> There are typos in return type of these functions:
> 1) timestamptz_pl_interval_at_zone(PG_FUNCTION_ARGS)
> NOW: PG_RETURN_TIMESTAMP(timestamptz_pl_interval_internal(timestamp,
> span, attimezone));
> SHOULD:
> PG_RETURN_TIMESTAMPTZ(timestamptz_pl_interval_internal(timestamp, span,
> attimezone));
> 2) Datum timestamptz_mi_interval_at_zone(PG_FUNCTION_ARGS)
> NOW: PG_RETURN_TIMESTAMP(timestamptz_mi_interval_internal(timestamp,
> span, attimezone));
> SHOULD:
> PG_RETURN_TIMESTAMPTZ(timestamptz_mi_interval_internal(timestamp, span,
> attimezone));
>
> 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?
--
Regards,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: BUG #19367: typos in backend/utils/adt/timestamp.c
2025-12-29 09:13 BUG #19367: typos in backend/utils/adt/timestamp.c PG Bug reporting form <noreply@postgresql.org>
2025-12-29 10:25 ` Re: BUG #19367: typos in backend/utils/adt/timestamp.c Rahila Syed <rahilasyed90@gmail.com>
2025-12-29 10:35 ` Re: BUG #19367: typos in backend/utils/adt/timestamp.c Japin Li <japinli@hotmail.com>
@ 2025-12-29 15:37 ` Tom Lane <tgl@sss.pgh.pa.us>
2025-12-30 02:30 ` Re: BUG #19367: typos in backend/utils/adt/timestamp.c Japin Li <japinli@hotmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Tom Lane @ 2025-12-29 15:37 UTC (permalink / raw)
To: Japin Li <japinli@hotmail.com>; +Cc: Rahila Syed <rahilasyed90@gmail.com>; fadeymail@rambler.ru; pgsql-bugs@lists.postgresql.org
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: BUG #19367: typos in backend/utils/adt/timestamp.c
2025-12-29 09:13 BUG #19367: typos in backend/utils/adt/timestamp.c PG Bug reporting form <noreply@postgresql.org>
2025-12-29 10:25 ` Re: BUG #19367: typos in backend/utils/adt/timestamp.c Rahila Syed <rahilasyed90@gmail.com>
2025-12-29 10:35 ` Re: BUG #19367: typos in backend/utils/adt/timestamp.c Japin Li <japinli@hotmail.com>
2025-12-29 15:37 ` Re: BUG #19367: typos in backend/utils/adt/timestamp.c Tom Lane <tgl@sss.pgh.pa.us>
@ 2025-12-30 02:30 ` Japin Li <japinli@hotmail.com>
0 siblings, 0 replies; 6+ messages in thread
From: Japin Li @ 2025-12-30 02:30 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Rahila Syed <rahilasyed90@gmail.com>; fadeymail@rambler.ru; pgsql-bugs@lists.postgresql.org
On Mon, 29 Dec 2025 at 10:37, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 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.
>
After greping, I found the following:
$ grep -e '^timestamp_pl_interval' -e '^timestamptz_pl_interval' -rn src/
src/backend/utils/adt/timestamp.c:3090:timestamp_pl_interval(PG_FUNCTION_ARGS)
src/backend/utils/adt/timestamp.c:3233:timestamptz_pl_interval_internal(TimestampTz timestamp,
src/backend/utils/adt/timestamp.c:3380:timestamptz_pl_interval(PG_FUNCTION_ARGS)
src/backend/utils/adt/timestamp.c:3401:timestamptz_pl_interval_at_zone(PG_FUNCTION_ARGS)
$ grep -e '^timestamp_mi_interval' -e '^timestamptz_mi_interval' -rn src/
src/backend/utils/adt/timestamp.c:3207:timestamp_mi_interval(PG_FUNCTION_ARGS)
src/backend/utils/adt/timestamp.c:3365:timestamptz_mi_interval_internal(TimestampTz timestamp,
src/backend/utils/adt/timestamp.c:3389:timestamptz_mi_interval(PG_FUNCTION_ARGS)
src/backend/utils/adt/timestamp.c:3412:timestamptz_mi_interval_at_zone(PG_FUNCTION_ARGS)
Since timestamptz_pl_interval() and timestamptz_mi_interval() are independent
functions (not just aliases or direct calls to the timestamp versions), their
return macros should be updated for accuracy: change any PG_RETURN_TIMESTAMP()
to the correct PG_RETURN_TIMESTAMPTZ().
The timestamptz_pl_interval_at_zone() and timestamptz_mi_interval_at_zone() may
still intentionally blur the distinction between timestamp and timestamptz
-- consistent with the historical design choices discussed earlier -- so they
can remain unchanged for now.
--
Regards,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.
^ permalink raw reply [nested|flat] 6+ messages in thread
* RE: BUG #19367: typos in backend/utils/adt/timestamp.c
2025-12-29 09:13 BUG #19367: typos in backend/utils/adt/timestamp.c PG Bug reporting form <noreply@postgresql.org>
2025-12-29 10:25 ` Re: BUG #19367: typos in backend/utils/adt/timestamp.c Rahila Syed <rahilasyed90@gmail.com>
@ 2025-12-29 12:20 ` =?UTF-8?b?0J3QuNC60L7Qu9Cw0Lkg0KTQsNC00LXQtdCy?= <fadeymail@rambler.ru>
1 sibling, 0 replies; 6+ messages in thread
From: Николай Фадеев @ 2025-12-29 12:20 UTC (permalink / raw)
To: Japin Li <japinli@hotmail.com>; Rahila Syed <rahilasyed90@gmail.com>; +Cc: fadeymail@rambler.ru; pgsql-bugs@lists.postgresql.org
Hi, everyone. Yes, according to prog file, these functions also have prorettype => timestamptz, so the should return timestamptz. 29.12.2025, 13:37, Japin Li < mailto:japinli@hotmail.com japinli@hotmail.com >
On Mon, 29 Dec 2025 at 15:55, Rahila Syed < /compose rahilasyed90@gmail.com > wrote: > Hi, > > There are typos in return type of these functions: > 1) timestamptz_pl_interval_at_zone(PG_FUNCTION_ARGS) > NOW: PG_RETURN_TIMESTAMP(timestamptz_pl_interval_internal(timestamp, > span, attimezone)); > SHOULD: > PG_RETURN_TIMESTAMPTZ(timestamptz_pl_interval_internal(timestamp, span, > attimezone)); > 2) Datum timestamptz_mi_interval_at_zone(PG_FUNCTION_ARGS) > NOW: PG_RETURN_TIMESTAMP(timestamptz_mi_interval_internal(timestamp, > span, attimezone)); > SHOULD: > PG_RETURN_TIMESTAMPTZ(timestamptz_mi_interval_internal(timestamp, span, > attimezone)); > > 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? -- Regards, Japin Li ChengDu WenWu Information Technology Co., Ltd.
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2025-12-30 02:30 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-12-29 09:13 BUG #19367: typos in backend/utils/adt/timestamp.c PG Bug reporting form <noreply@postgresql.org>
2025-12-29 10:25 ` Rahila Syed <rahilasyed90@gmail.com>
2025-12-29 10:35 ` Japin Li <japinli@hotmail.com>
2025-12-29 15:37 ` Tom Lane <tgl@sss.pgh.pa.us>
2025-12-30 02:30 ` Japin Li <japinli@hotmail.com>
2025-12-29 12:20 ` =?UTF-8?b?0J3QuNC60L7Qu9Cw0Lkg0KTQsNC00LXQtdCy?= <fadeymail@rambler.ru>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox