Subject Re: [firebird-support] sum of integers results in an overflow
Author Steve Wiser
Ivan Prenosil wrote:
>
> > We recently converted our applications from Interbase 5.6 to Firebird
> > 1.5.3 Classic on linux. So far it has gone well and there have been a
> > lot of nice query speed-ups without us having to do anything! However,
> > I just received a defect notice from one of our developers that a
report
> > is now failing our regression tests. We traced it down to a "select
> > sum" query that is adding up an integer column. We are using Dialect 1
> > since we are still in the middle of converting our trigger and stored
> > procedure code as well as trying to move off of the date-time fields.
> > Selecting a sum of integers where the result would overflow an integer
> > seems to work in Dialect 3, but not in Dialect 1. We can work around it
> > by casting the field to a double which seems to cause the sum to return
> > a double rather than an integer. However, I would prefer not to have to
> > find out where else in the code this might happen. I am not even sure
> > if this would overflow in Interbase since we never saw this behavior
> > before. We converted all of our test servers over, so I will have to
> > set one up and try it out...
> >
> > Anyways my question is: Is this a bug in Firebird with Dialect 1?
>
> One possibility is that it is a bug in FB (although I am not aware of
it).
> Can you send reproducible test case ?
>
> The other possibility is that it is a bug in IB - perhaps the
overflow exception
> is correct (for given data and datatype), but IB will send you wrong
result instead.
> Are you sure the results in IB5.6 are always correct ?
>
> Ivan
> http://www.volny.cz/iprenosil/interbase/

We are creating a test script to see if it is reproducible or maybe just
a bad db on our part? I will post it once we have verified it again.

-steve