Re: Question about integer out of range in function

From: Condor <condor(at)stz-bg(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Question about integer out of range in function
Date: 2021-05-14 16:54:12
Message-ID: 885da7b25586b07fb919b4c34222d4d9@stz-bg.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 14-05-2021 17:42, Tom Lane wrote:
> Condor <condor(at)stz-bg(dot)com> writes:
>> new_time = fromtime * 1000; -- here is line 19
>
> Are you entirely certain that you counted lines correctly?
> If new_time and fromtime are both declared bigint, and
> fromtime is on the order of
>
> # select extract(epoch from now())::bigint;
> extract
> ------------
> 1621003124
> (1 row)
>
> then there's no way that that statement fails on integer overflow.
>
> What I'm wondering about is the next line:
>
>> unix_time = (new_time + rand_int)::BIGINT;
>
> You've not shown us the declaration of unix_time ...
>
> regards, tom lane

Sorry,
I was thinking I get the function from contrib and I think you guys know
it.
unix_time is BIGINT but I make a few more changes and now can't restore
old function to reproduce the problem.

I will try to recover the code later.

Regards,
HS

In response to

Browse pgsql-general by date

  From Date Subject
Next Message frank picabia 2021-05-14 17:14:34 Empty tablespace directory after restore with psql -d dbname -f dump.sql
Previous Message Francisco Olarte 2021-05-14 16:37:35 Re: RETURNING, CTEs and TRANSACTION ISOLATION levels...