Re: Question about integer out of range in function

2021-05-21 Thread Peter J. Holzer
On 2021-05-16 11:09:38 -0700, David G. Johnston wrote: > On Sunday, May 16, 2021, Condor wrote: > > >      new_time = fromtime * 1000; -- here is line 19 >       > > > An integer times an integer results in an integer.  Period.  Neither fromtime > nor new_time have been assigned to yet

Question about integer out of range in function

2021-05-16 Thread David G. Johnston
On Sunday, May 16, 2021, Condor wrote: > > new_time = fromtime * 1000; -- here is line 19 > > An integer times an integer results in an integer. Period. Neither fromtime nor new_time have been assigned to yet, the in-memory result of the computation is only allocated integer bits and if y

Re: Question about integer out of range in function

2021-05-16 Thread Condor
On 14-05-2021 17:42, Tom Lane wrote: Condor 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;

Re: Question about integer out of range in function

2021-05-14 Thread Condor
On 14-05-2021 17:42, Tom Lane wrote: Condor 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;

Re: Question about integer out of range in function

2021-05-14 Thread Tom Lane
Condor 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

Re: Question about integer out of range in function

2021-05-14 Thread Ron
On 5/14/21 1:38 AM, Condor wrote: Hello ppl, I have a question about ERROR:  integer out of range in one function. I modify the generate_ulid() function to accept also UNIX timestamp as input parameter. I drop old function and make new one: CREATE FUNCTION generate_ulid(fromtime bigint defa

Question about integer out of range in function

2021-05-13 Thread Condor
Hello ppl, I have a question about ERROR: integer out of range in one function. I modify the generate_ulid() function to accept also UNIX timestamp as input parameter. I drop old function and make new one: CREATE FUNCTION generate_ulid(fromtime bigint default 0) Then I declare two new var