pgjdbc-ng
pgjdbc-ng copied to clipboard
Inconsistent Handling of Invalid setFetchDirection Input between ResultSet and Statement
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
}