Re: Question about integer out of range in function - Mailing list pgsql-general

From Tom Lane
Subject Re: Question about integer out of range in function
Date
Msg-id 1883415.1621003343@sss.pgh.pa.us
Whole thread Raw
In response to Question about integer out of range in function  (Condor <condor@stz-bg.com>)
Responses Re: Question about integer out of range in function
Re: Question about integer out of range in function
List pgsql-general
Condor <condor@stz-bg.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



pgsql-general by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: Query on postgres_fdw extension
Next
From: "David G. Johnston"
Date:
Subject: Re: Same column names in a subresult table