From: | "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Question about integer out of range in function |
Date: | 2021-05-21 15:17:52 |
Message-ID: | 20210521151752.GA23484@hjp.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 2021-05-16 11:09:38 -0700, David G. Johnston wrote:
> On Sunday, May 16, 2021, Condor <condor(at)stz-bg(dot)com> 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 you overflow that you get an error.
This is also true in C, btw, except that in C an overflow of a signed
int is undefined behaviour while an unsigned int is required to wrap
around.
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2021-05-21 15:25:53 | Re: The contents of the pg_timezone_names view bring some surprises |
Previous Message | Ian Lawrence Barwick | 2021-05-21 11:46:52 | Re: I have no idea why pg_dump isn't dumping all of my data |