Subject Re: [firebird-support] sum of integers results in an overflow
Author Ivan Prenosil
> create table TEST_TABLE (
> integerValue INTEGER
> );
>
> insert into TEST_TABLE ( integerValue ) values ( 1000000000 );
> insert into TEST_TABLE ( integerValue ) values ( 2000000000 );
>
> select sum( cast( integerValue as DOUBLE PRECISION ) )
> from test_table;
>
> select sum( integerValue )
> from test_table;
>
> ***
>
> The first select sum works in Interbase 5.6, Firebird 1.5.3 Dialect 1,
> and Firebird 1.5.3 Dialect 3.

Which is correct, it is difficult to overflow double.

> The second select sum works in Firebird
> 1.5.3 Dialect 3

Which is correct too, since the sum is done using Bigint.

> and throws an overflow exception in Firebird 1.5.3
> Dialect 1 *and* Interbase 5.6...

And it is correct too, the sum can' fit into Integer.

>
> So I guess it functions exactly how it did in Interbase which is what it
> is supposed to do.

Right.

Ivan