Hello,
We have a strange behavior when running this code :
public static void main(String[] args) {
try {
Class.forName("org.postgresql.Driver");
Properties props = new Properties();
props.setProperty("user", "postgres");
props.setProperty("password", "mypassword");
Connection _connexion = DriverManager.getConnection(
"jdbc:postgresql://<ip>:5432/personnel", props);
_connexion
.prepareStatement(
"create temporary table test_oliv (val
real);insert into test_oliv(val) values (1.8);"
+ "insert into test_oliv(val) values
(1.8);insert into test_oliv(val) values (1.8);")
.execute();
ResultSet rs = _connexion.prepareStatement(
"select sum(val) as t from test_oliv;").executeQuery();
rs.next();
System.out.println("Float: " + rs.getFloat("t"));
System.out.println("Double: " + rs.getDouble("t"));
System.out.println("Object: " + rs.getObject("t"));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
The results are :
Float: 5.3999996
Double: 5.3999996
Object: 5.3999996
With 8.2 driver the results are rights.
Idea ?
Regards