Subject | sum of integers results in an overflow |
---|---|
Author | Steve Wiser |
Post date | 2007-03-15T21:04:21Z |
Hello,
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?
Thanks,
Steve
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?
Thanks,
Steve