Bug #5717 MYSQL J/Connector doesnt handle "inf" and "nan"
Submitted: 23 Sep 2004 13:04 Modified: 23 Sep 2004 15:31
Reporter: Fabrice Marchal Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:4.X.X OS:Any (all)
Assigned to: Mark Matthews CPU Architecture:Any

[23 Sep 2004 13:04] Fabrice Marchal
Description:
The getDouble() method from ResultsSet.java does not handle the case
where an "inf" , "-inf" or "nan" value is stored in the MYSQL database.
Sould return Double.POSITIVE_INFINITY, .. , Double.NaN

How to repeat:
CREATE table AA ( x real );
INSERT "inf" INTO AA;

from Java
SELECT * FROM AA
rs.getDouble(1)
[23 Sep 2004 15:31] Mark Matthews
The SQL standard doesn't allow one to store +/-inf or NaN in double fields (see section 5.3 of the SQL 2003 specification if you're interested in the details).

It is a side effect of the floating point libraries that MySQL uses on some platforms that the database accepts +/-inf and NaN in some cases. In the future, MySQL will not.

The JDBC driver will be changed to throw an exception if a double value is +/- inf and NaN in version 3.1.5.