From d71fa760c7d99e206cad607913ed75059363bf0b Mon Sep 17 00:00:00 2001 From: Kris Jurka Date: Mon, 12 Mar 2012 17:33:40 -0700 Subject: [PATCH] Fix ResultSetMetaData retrieval when the oid counter exceeds INT_MAX. Since Java doesn't have unsigned ints we retrieve the values as long and then truncate to int, so it may have a negative value. As reported by Owen Tran. --- org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java b/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java index 168a14249..bd31544bf 100644 --- a/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java +++ b/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java @@ -237,8 +237,8 @@ private void fetchFieldMetaData() throws SQLException { Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(sql.toString()); while (rs.next()) { - int table = rs.getInt(1); - int column = rs.getInt(2); + int table = (int)rs.getLong(1); + int column = (int)rs.getLong(2); String columnName = rs.getString(3); String tableName = rs.getString(4); String schemaName = rs.getString(5);