From e08a6ccfc5158f452f910030a08dea6eea15d1b8 Mon Sep 17 00:00:00 2001 From: Sehrope Sarkuni Date: Tue, 25 Jan 2022 10:40:16 -0500 Subject: [PATCH] test: Disable no-arg callable statement tests in simple query mode 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 #2399 for more details. --- pgjdbc/src/test/java/org/postgresql/test/jdbc2/BaseTest4.java | 4 ++++ .../org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java | 3 +++ 2 files changed, 7 insertions(+) diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/BaseTest4.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/BaseTest4.java index 5640799459..de4b9dd199 100644 --- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/BaseTest4.java +++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/BaseTest4.java @@ -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)}. */ diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java index 822bdf8082..17cf45003b 100644 --- a/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java +++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java @@ -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(); @@ -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 { @@ -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();