From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | gyenese(at)mediagnost(dot)hu |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: int4, int8, real ....division... |
Date: | 2004-05-20 16:41:41 |
Message-ID: | 2110.1085071301@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
"=?iso-8859-2?Q?Gyenese_P=E1l_Attila?=" <gyenese(at)mediagnost(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-05-20 18:10:59 | Re: postgres crashes |
Previous Message | Sün | 2004-05-20 16:30:53 | LATIN2 'bssz' and 'bszsz' fails on unique index |