Skip to content
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

Do not send auto savepoint in simpleQuery mode fixes Issue 3107 #3112

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/content/documentation/server-prepare.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ following might be helpful to debug the case.

1. Client logging. If you add `loggerLevel=TRACE&loggerFile=pgjdbc-trace.log`, you would get trace
of the messages send between the driver and the backend
1. You might check `org.postgresql.test.jdbc2.AutoRollbackTestSuite` as it verifies lots of combinations
1. You might check `org.postgresql.test.jdbc2.AutoRollbackTest` as it verifies lots of combinations

##### Example 9.3. Using server side prepared statements

Expand Down Expand Up @@ -974,4 +974,4 @@ try (Connection con = DriverManager.getConnection(url, "postgres", "somepassword
}
```

More examples can be found in the [Copy Test Code](https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/test/java/org/postgresql/test/jdbc2/CopyTest.java)
More examples can be found in the [Copy Test Code](https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/test/java/org/postgresql/test/jdbc2/CopyTest.java)
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,7 @@ && getAutoSave() != AutoSave.NEVER
SAVEPOINTS.
*/
sendOneQuery(autoSaveQuery, SimpleQuery.NO_PARAMETERS, 1, 0,
QUERY_NO_RESULTS | QUERY_NO_METADATA
// PostgreSQL does not support bind, exec, simple, sync message flow,
// so we force autosavepoint to use simple if the main query is using simple
| QUERY_EXECUTE_AS_SIMPLE);
QUERY_NO_RESULTS | QUERY_NO_METADATA);
return true;
}
return false;
Expand All @@ -444,8 +441,7 @@ && getAutoSave() == AutoSave.ALWAYS
&& getTransactionState() == TransactionState.OPEN) {
try {
sendOneQuery(releaseAutoSave, SimpleQuery.NO_PARAMETERS, 1, 0,
QUERY_NO_RESULTS | QUERY_NO_METADATA
| QUERY_EXECUTE_AS_SIMPLE);
QUERY_NO_RESULTS | QUERY_NO_METADATA);

} catch (IOException ex) {
throw new PSQLException(GT.tr("Error releasing savepoint"), PSQLState.IO_ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import java.util.concurrent.atomic.AtomicInteger;

@RunWith(Parameterized.class)
public class AutoRollbackTestSuite extends BaseTest4 {
public class AutoRollbackTest extends BaseTest4 {
private static final AtomicInteger counter = new AtomicInteger();

private enum CleanSavePoint {
Expand Down Expand Up @@ -125,7 +125,7 @@ private enum ContinueMode {
private final TestStatement testSql;
private final ReturnColumns cols;

public AutoRollbackTestSuite(AutoSave autoSave, CleanSavePoint cleanSavePoint, AutoCommit autoCommit,
public AutoRollbackTest(AutoSave autoSave, CleanSavePoint cleanSavePoint, AutoCommit autoCommit,
FailMode failMode, ContinueMode continueMode, boolean flushCacheOnDeallocate,
boolean trans, TestStatement testSql, ReturnColumns cols) {
this.autoSave = autoSave;
Expand Down