Skip to content

Commit

Permalink
test: Disable no-arg callable statement tests in simple query mode
Browse files Browse the repository at this point in the history
Disables the JDBC function call syntax callable statement tests with no arguments
when running the test suite in simple query mode. The new tests fail with simple
query mode as internal JDBC-to-native query parser generates SQL that contains
the out parameters in the SQL body which is only ignored by the server when
processed in an extended parse, bind, execute sequence. When executed as a simple
query command the server does not ignore the extra parameters and the query
fails.

This commit does not fix anything yet. It simply skips the new failing test in simple
query mode so that the rest of the quite can execute. The behavior of the driver has
not changed in the recent additions either, the new tests simply brought to light an
existing issue with simple query mode.

See pgjdbc#2399 for more details.
  • Loading branch information
sehrope committed Jan 25, 2022
1 parent 6631a41 commit e08a6cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pgjdbc/src/test/java/org/postgresql/test/jdbc2/BaseTest4.java
Expand Up @@ -109,6 +109,10 @@ public void assumeBinaryModeForce() {
Assume.assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE);
}

public void assumeNotSimpleQueryMode() {
Assume.assumeTrue(preferQueryMode != PreferQueryMode.SIMPLE);
}

/**
* Shorthand for {@code Assume.assumeTrue(TestUtil.haveMinimumServerVersion(conn, version)}.
*/
Expand Down
Expand Up @@ -395,6 +395,7 @@ public void testSetObjectBit() throws Throwable {

@Test
public void testGetBit1WithoutArg() throws SQLException {
assumeNotSimpleQueryMode();
try (CallableStatement call = con.prepareCall("{ ? = call testspg__getBit1WithoutArg () }")) {
call.registerOutParameter(1, Types.BOOLEAN);
call.execute();
Expand All @@ -404,6 +405,7 @@ public void testGetBit1WithoutArg() throws SQLException {

@Test
public void testGetBit2WithoutArg() throws SQLException {
assumeNotSimpleQueryMode();
try (CallableStatement call = con.prepareCall("{ ? = call testspg__getBit2WithoutArg () }")) {
call.registerOutParameter(1, Types.BOOLEAN);
try {
Expand Down Expand Up @@ -980,6 +982,7 @@ public void testGetBoolean01() throws Throwable {

@Test
public void testGetBooleanWithoutArg() throws SQLException {
assumeNotSimpleQueryMode();
try (CallableStatement call = con.prepareCall("{ ? = call testspg__getBooleanWithoutArg () }")) {
call.registerOutParameter(1, Types.BOOLEAN);
call.execute();
Expand Down

0 comments on commit e08a6cc

Please sign in to comment.