On 2020-Aug-31, Ranier Vilela wrote:
> More troubles with undefined-behavior.
>
> This type of code can leaves overflow:
> var = (cast) (expression);
> diff = (int32) (id1 - id2);
>
> See:
> diff64 = ((long int) d1 - (long int) d2);
> diff64=-4294901760
Did you compile this with gcc -fwrapv?
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services