Re: SupportRequestRows support function for generate_series_timestamptz

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: SupportRequestRows support function for generate_series_timestamptz
Date: 2024-07-08 04:43:45
Message-ID: CACJufxFk-=A91FG+Cm+BAVfK8tidJ1Bs9V5r+-+sFndPfR1nDg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 8, 2024 at 12:02 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
> > /*
> > * Protect against overflows in timestamp_mi. XXX convert to
> > * ereturn one day?
> > */
> > if (!TIMESTAMP_NOT_FINITE(start) && !TIMESTAMP_NOT_FINITE(finish) &&
> > !pg_sub_s64_overflow(finish, start, &dummy))
> >
> > i don't understand the comment "XXX convert to ereturn one day?".
>
> The problem I'm trying to work around there is that timestamp_mi
> raises an ERROR if there's an overflow. I don't want the support
> function to cause an ERROR so I'm trying to only call timestamp_mi in
> cases where it won't error. The ereturn mention is a reference to
> ERROR raising infrastructure added by d9f7f5d32 and so far only used
> by input functions. It would be possible to use that to save from
> having to do the pg_sub_s64_overflow(). Instead, we could check if
> any errors were found and only proceed with the remaining part of the
> calculation if none were found.
>
> I've tried to improve the comment in the attached version. I removed
> the reference to ereturn.
>
got it.

{ oid => '2031',
proname => 'timestamp_mi', prorettype => 'interval',
proargtypes => 'timestamp timestamp', prosrc => 'timestamp_mi' },
{ oid => '1188',
proname => 'timestamptz_mi', prorettype => 'interval',
proargtypes => 'timestamptz timestamptz', prosrc => 'timestamp_mi' },

so this also apply to

{ oid => '938', descr => 'non-persistent series generator',
proname => 'generate_series', prorows => '1000', proretset => 't',
prorettype => 'timestamp', proargtypes => 'timestamp timestamp interval',
prosrc => 'generate_series_timestamp' },

If so, then we need to update src/include/catalog/pg_proc.dat also?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2024-07-08 05:16:00 Re: SupportRequestRows support function for generate_series_timestamptz
Previous Message feichanghong 2024-07-08 04:41:43 Re: Optimize commit performance with a large number of 'on commit delete rows' temp tables