Skip to content
Permalink
Browse files

fix issue #838 make sure we don't get columns that are dropped (#840)

* fix issue #838 make sure we don't get columns that are dropped

* added test case
  • Loading branch information
davecramer committed Jun 12, 2017
1 parent abc3d9d commit 464a2d43519004174f1b530a595ee0ad9ffda870
@@ -1137,7 +1137,7 @@ public ResultSet getProcedureColumns(String catalog, String schemaPattern,
if (returnTypeType.equals("c") || (returnTypeType.equals("p") && argModesArray != null)) {
String columnsql = "SELECT a.attname,a.atttypid FROM pg_catalog.pg_attribute a "
+ " WHERE a.attrelid = " + returnTypeRelid
+ " AND a.attnum > 0 ORDER BY a.attnum ";
+ " AND NOT a.attisdropped AND a.attnum > 0 ORDER BY a.attnum ";
Statement columnstmt = connection.createStatement();
ResultSet columnrs = columnstmt.executeQuery(columnsql);
while (columnrs.next()) {
@@ -492,6 +492,22 @@ public void testDroppedColumns() throws SQLException {
assertEquals(3, rs.getInt("ORDINAL_POSITION"));
assertTrue(!rs.next());
rs.close();

/* getFunctionColumns also has to be aware of dropped columns
add this in here to make sure it can deal with them
*/
rs = dbmd.getFunctionColumns(null, null, "f4", null);
assertTrue(rs.next());

assertTrue(rs.next());
assertEquals("id", rs.getString(4));

assertTrue(rs.next());
assertEquals("updated", rs.getString(4));


rs.close();

}

@Test

0 comments on commit 464a2d4

Please sign in to comment.
You can’t perform that action at this time.