This Java code works with a DB2 database, and a PostgreSQL database.
rs = stmt.executeQuery(qry);
rsMetaData = rs.getMetaData();
numCols = rsMetaData.getColumnCount();
say("resultSet MetaData column Count=" + numCols);
But when I ask for the size of any column, I get an impossible large number for a PostgreSQL
width = rsMetaData.getColumnDisplaySize(col);
DB2 returns accurate column size but PostgreSQL gives this:
table_catalog POSITION(1) varchar(2147483647)
The Driver is org.postgresql.Driver - postgresql-9.2-1002.jdbc4.jar
This size (2147483647) is returned for all the columns in the table. Is this a bug in the PostgreSQL or in Java ResultSetMetaData? How can I get the true width of columns in PostgreSQL?