The following bug has been logged online:
Bug reference: 1712
Logged by: Gilles Dubochet
Email address: dubochet@urbanet.ch
PostgreSQL version: 8.0.2
Operating system: Linux
Description: JDBC column precision for bigint is 0
Details:
Whith the JDBC driver at least up to version 8.1dev-400, the result of the
getPrecision method of ResultSetMetaData on a bigint column is 0 instead of
the expected 19.
Code seems to be missing in
org.postgresql.jdbc2.AbstractJdbc2ResultSetMetadata after line 359 (in
source code 8.1dev-400).
Java code to reproduce problem:
import java.sql.*;
public class Main {
public static void main(String[] args) throws Exception {
Class.forName("org.postgresql.Driver");
Connection con =
DriverManager.getConnection("jdbc:postgresql://localhost/pguser", "pguser",
"");
Statement stmt = con.createStatement();
stmt.execute("DROP TABLE mytable");
stmt.execute("CREATE TABLE mytable (bi BIGINT)");
System.out.println("We get "+
stmt.executeQuery("select * from
mytable").getMetaData().getPrecision(1)+
" but should get 19");
}
}