impossibl / pgjdbc-ng

A new JDBC driver for PostgreSQL aimed at supporting the advanced features of JDBC and Postgres
https://impossibl.github.io/pgjdbc-ng
Other
596 stars 108 forks source link

Inconsistency between rs.getType() and stmt.getResultSetType() #595

Open dwenking opened 8 months ago

dwenking commented 8 months ago

In the provided test case, a Statement object is created with specific ResultSet type parameters, and a query is executed to obtain a ResultSet. However, the type of the ResultSet as reported by rs.getType() does not match the type specified in the Statement object and returned by stmt.getResultSetType().

@Test
public void test() throws SQLException {
    Connection con;
    Statement stmt;
    ResultSet rs;

    con = DriverManager.getConnection("jdbc:pgsql://localhost:5432/test11?user=user&password=password");
    stmt = con.createStatement(1005, 1007, 2);
    stmt.execute("CREATE TABLE table11_0(id VARCHAR(5) PRIMARY KEY,value BIT);");
    rs = stmt.executeQuery("SELECT * FROM table11_0;");

    System.out.println(rs.getType());
    System.out.println(stmt.getResultSetType());

    rs.close();
    stmt.close();
    con.close();
}