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
600 stars 108 forks source link

Inconsistent Handling of Invalid setFetchDirection Input between ResultSet and Statement #596

Open dwenking opened 10 months ago

dwenking commented 10 months ago

When an invalid fetch direction value is passed to setFetchDirection, the ResultSet object accepts it without throwing an exception, whereas the Statement object correctly throws a SQLException for the same invalid input.

@Test
public void test() throws SQLException {
    Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/test11?user=user&password=password");
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.getGeneratedKeys();
    rs.setFetchDirection(425635067); // succeed
    System.out.println(rs.getFetchDirection());
    stmt.setFetchDirection(425635067); // java.sql.SQLException: Illegal argument
}