Bug #6619 getString behaviour different in 3.1 from 3.0
Submitted: 15 Nov 2004 5:08 Modified: 16 Nov 2004 9:38
Reporter: Robert Nice Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:3.1.4 OS:Linux (RH 9)
Assigned to: CPU Architecture:Any

[15 Nov 2004 5:08] Robert Nice
select SUM(int col) FROM table;

In 3.0.x
getString(n) = '12345';

In 3.1.4
getString(b) = '12345.0'

Why in 3.1.4 does int+int=floaty type.


select SUM(decimal(9,2) col) / SUM(decimal(9,2) other) FROM table;

In 3.0.x
getString(n) = '123.45';

In 3.1.4
getString(n) = '123.455555555556';

I would expect getString() to return the same characters as I get from the mysql client program which is consistent.

I'm using MySQL 4.1.7 and I use prepared statements in a connection pool.

How to repeat:
I'm hoping this is pretty obvious and I don't need to write a specific program to demo this. If I do please let me know.
[16 Nov 2004 4:33] Mark Matthews
Not a Connector/J issue. This is a server bug, the field type reported by the server when using prepared statements for sum(int), is 'double' !?
[16 Nov 2004 6:42] Robert Nice
Not saying you're not correct, but why does 3.0.x work as expected?
[16 Nov 2004 9:38] Sergei Golubchik
it's not a bug. Server cannot report int for sum(), because the result of sum(int) may not fit into int. Thus double.

In 5.0 it will be decimal with the scale 0.
[16 Nov 2004 16:35] Robert Nice
Server aside, why does Conn/J 3.0.x work, and the MySQL console work, but Conn/J 3.1.7 does not?