Re: [BUGS] int4, int8, real ....division...

2004-05-21 Thread Tom Lane
Neil Conway <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> 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.) > Or am I misreading the spec? Spec compliance is

Re: [BUGS] int4, int8, real ....division...

2004-05-21 Thread Neil Conway
Tom Lane wrote: 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 seems to me that SQL2003, Section 6.26 (, "General Rules", item 5) requires that we check for over

Re: [BUGS] int4, int8, real ....division...

2004-05-20 Thread Tom Lane
"=?iso-8859-2?Q?Gyenese_P=E1l_Attila?=" <[EMAIL PROTECTED]> writes: > REASON IS: > SELECT 365*1000 ; > 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,

[BUGS] int4, int8, real ....division...

2004-05-20 Thread Gyenese Pál Attila
pgsql-7.4.2 I think it's not a bug, just interesting results: SELECT 9223372036854775807/(365*1000) ; result: -14300526699 wrong SELECT ( 9223372036854775807/365 )/1000 ; result: 2526951242 good SELECT ( 9223372036854775807::real /(365*1000) ) ; result: -14300526699,6589 w