@Test
public void testRecursiveResultSets() throws SQLException {
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT '{{1,2},{3,4}}'::int[]");
assertTrue(rs.next());
Array arr = rs.getArray(1);
ResultSet arrRS = arr.getResultSet();
ResultSetMetaData arrRSMD = arrRS.getMetaData();
assertEquals(Types.ARRAY, arrRSMD.getColumnType(2));
assertEquals("_int4", arrRSMD.getColumnTypeName(2));
assertTrue(arrRS.next());
assertEquals(1, arrRS.getInt(1));
Array a1 = arrRS.getArray(2);
ResultSet a1RS = a1.getResultSet();
ResultSetMetaData a1RSMD = a1RS.getMetaData();
assertEquals(Types.INTEGER, a1RSMD.getColumnType(2));
assertEquals("int4", a1RSMD.getColumnTypeName(2));
assertTrue(a1RS.next());
assertEquals(1, a1RS.getInt(2));
assertTrue(a1RS.next());
assertEquals(2, a1RS.getInt(2));
assertTrue(!a1RS.next());
a1RS.close();
assertTrue(arrRS.next());
assertEquals(2, arrRS.getInt(1));
Array a2 = arrRS.getArray(2);
ResultSet a2RS = a2.getResultSet();
assertTrue(a2RS.next());
assertEquals(3, a2RS.getInt(2));
assertTrue(a2RS.next());
assertEquals(4, a2RS.getInt(2));