"Gyenese Pál Attila" <gyenese@mediagnost.hu> writes:
> REASON IS:
> SELECT 365*10000000 ;
> result: -644967296
> wrong
This isn't a division problem --- the difficulty is there's no check for
overflow in int4 multiplication. (Nor in any of the other integer
arithmetic operations, for that matter.)
It'd be nice if C made it easier to detect integer overflow :-(
... AFAIK, testing this would make those subroutines many times slower,
which is pretty annoying when the hardware already knows whether the
result overflowed or not.
regards, tom lane