New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: close refcursors when underlying cursor==null instead of relying on defaultRowFetchSize #2377
Conversation
4ad3aac
to
9e03dd1
Compare
9e03dd1
to
1c9d007
Compare
b7e1742
to
1314bb1
Compare
This PR fixes the following test as well (it is covered with the new parameterized test), so this PR fixes regression introduced in #2371 @Test
public void testRefCursorWithFetchSizeOnResultSet() throws SQLException {
int cnt = 0;
try (CallableStatement call = con.prepareCall("{? = call test_blob()}")) {
con.setAutoCommit(false); // ref cursors only work if auto commit is off
call.registerOutParameter(1, Types.REF_CURSOR);
call.execute();
try (ResultSet rs = (ResultSet) call.getObject(1)) {
rs.setFetchSize(50);
while (rs.next()) {
cnt++;
}
}
assertEquals(101, cnt);
}
} |
d5d771d
to
acdb7dd
Compare
It might be that reusing connections for the tests would help, however, it would likely require rework of |
any reason we aren't merging this ? |
I think it is fine |
… on defaultRowFetchSize See pgjdbc#2227 See pgjdbc#2371
That's pretty significant. Thanks for tracking this down. |
PgResultSet
might holdResultCursor cursor
for fetching the next rows.So we should use
ResultCursor cursor==null
condition to check if we want to close<unnamed portal 1>
from refcursors.See #2227
See #2371
/cc @davecramer