[Git][java-team/libpostgresql-jdbc-java][master] 3 commits: New upstream version 42.2.12

Christoph Berg gitlab at salsa.debian.org
Thu Apr 30 08:57:37 BST 2020



Christoph Berg pushed to branch master at Debian Java Maintainers / libpostgresql-jdbc-java


Commits:
65b0fb39 by Christoph Berg at 2020-04-30T09:49:33+02:00
New upstream version 42.2.12
- - - - -
9c7431bd by Christoph Berg at 2020-04-30T09:49:39+02:00
Update upstream source from tag 'upstream/42.2.12'

Update to upstream version '42.2.12'
with Debian dir 54bfacf645bb9213a66d0178ce030a8fe3eb72ff
- - - - -
fe009311 by Christoph Berg at 2020-04-30T09:56:38+02:00
New upstream version.

- - - - -


25 changed files:

- CHANGELOG.md
- contributors.json
- debian/changelog
- docs/_posts/2020-03-10-42.2.11-release.md
- + docs/_posts/2020-03-31-42.2.12-release.md
- docs/documentation/head/connect.md
- pgjdbc/pom.xml
- pgjdbc/src/main/java/org/postgresql/PGProperty.java
- pgjdbc/src/main/java/org/postgresql/core/QueryExecutor.java
- pgjdbc/src/main/java/org/postgresql/core/QueryExecutorBase.java
- pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java
- pgjdbc/src/main/java/org/postgresql/ds/common/BaseDataSource.java
- pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java
- pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java
- pgjdbc/src/main/java/org/postgresql/xa/PGXAConnection.java
- pgjdbc/src/test/java/org/postgresql/test/jdbc2/ArrayTest.java
- pgjdbc/src/test/java/org/postgresql/test/jdbc2/AutoRollbackTestSuite.java
- pgjdbc/src/test/java/org/postgresql/test/jdbc2/BatchExecuteTest.java
- pgjdbc/src/test/java/org/postgresql/test/jdbc2/BatchFailureTest.java
- pgjdbc/src/test/java/org/postgresql/test/jdbc2/Jdbc2TestSuite.java
- pgjdbc/src/test/java/org/postgresql/test/jdbc2/MiscTest.java
- − pgjdbc/src/test/java/org/postgresql/test/jdbc2/TransactionTest.java
- pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3SavepointTest.java
- − pgjdbc/src/test/java/org/postgresql/test/xa/XAPrepareFailureTest.java
- pom.xml


Changes:

=====================================
CHANGELOG.md
=====================================
@@ -10,6 +10,21 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 
 ### Fixed
 
+## [42.2.12] (2020-03-31)
+
+**Notable changes**
+
+We have released 42.2.12 to correct regressions in this version: Specifically
+- [PR 1729](https://github.com/pgjdbc/pgjdbc/pull/1729) was reverted as this is a breaking change
+- [PR 1719](https://github.com/pgjdbc/pgjdbc/pull/1719) has been reverted as it introduced errors in the PgType Cache
+
+We recommend that this version 42.2.11 not be used.
+### Changed
+ - reverted [PR 1729](https://github.com/pgjdbc/pgjdbc/pull/1729)  throw an error instead of silently rolling back a commit error. 
+ This change introduced a breaking change which will be moved to 42.3.0
+ - reverted [PR 1719](https://github.com/pgjdbc/pgjdbc/pull/1719)  add support for full names of data types (#1719)
+
+
 ## [42.2.11] (2020-03-07)
 ### Changed
  - Reverted [PR 1641](https://github.com/pgjdbc/pgjdbc/pull/1252). The driver will now wait for EOF when sending cancel signals. 
@@ -316,4 +331,5 @@ thrown to caller to be dealt with so no need to log at this verbosity by pgjdbc
 [42.2.9]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.8...REL42.2.9
 [42.2.10]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.9...REL42.2.10
 [42.2.11]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.10...REL42.2.11
-[Unreleased]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.11...HEAD
+[42.2.12]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.11...REL42.2.12
+[Unreleased]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.12...HEAD


=====================================
contributors.json
=====================================
@@ -10,6 +10,7 @@
    "Brett Wooldridge" : "https://github.com/brettwooldridge",
    "Chen Huajun" : "https://github.com/ChenHuajun",
    "Christian Kotzbauer" : "https://github.com/code-chris",
+   "Christian Ramseyer" : "https://github.com/rc9000",
    "Christian Ullrich" : "https://github.com/chrullrich",
    "Christoph Berg" : "https://github.com/ChristophBerg",
    "Christopher Deckers" : "https://github.com/Chrriis",


=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+libpgjava (42.2.12-1) unstable; urgency=medium
+
+  * New upstream version.
+
+ -- Christoph Berg <myon at debian.org>  Thu, 30 Apr 2020 09:49:54 +0200
+
 libpgjava (42.2.11-1) unstable; urgency=medium
 
   * New upstream version.


=====================================
docs/_posts/2020-03-10-42.2.11-release.md
=====================================
@@ -7,6 +7,13 @@ version: 42.2.11
 ---
 **Notable changes**
 
+We have released 42.2.12 to correct regressions in this version: Specifically
+- [PR 1729](https://github.com/pgjdbc/pgjdbc/pull/1729) was reverted as this is a breaking change 
+- [PR 1719](https://github.com/pgjdbc/pgjdbc/pull/1719) has been reverted as it introduced errors in the PgType Cache
+
+We recommend that this version 42.2.11 not be used.
+
+
 ### Changed
  - Reverted [PR 1641](https://github.com/pgjdbc/pgjdbc/pull/1252). The driver will now wait for EOF when sending cancel signals. 
  - `DatabaseMetaData#getProcedures` returns only procedures (not functions) for PostgreSQL 11+ [PR 1723](https://github.com/pgjdbc/pgjdbc/pull/1723)


=====================================
docs/_posts/2020-03-31-42.2.12-release.md
=====================================
@@ -0,0 +1,43 @@
+---
+title: PostgreSQL JDBC Driver 42.2.12 Released
+date: 2020-03-31 13:06:22 +0000
+categories:
+  - new_release
+version: 42.2.12
+---
+**Notable changes**
+
+### Changed
+ - reverted [PR 1729](https://github.com/pgjdbc/pgjdbc/pull/1729)  throw an error instead of silently rolling back a commit error. 
+ This change introduced a breaking change which will be moved to 42.3.0
+ - reverted [PR 1719](https://github.com/pgjdbc/pgjdbc/pull/1719)  add support for full names of data types (#1719)
+
+### Added
+
+### Fixed
+
+
+<!--more-->
+
+**Commits by author**
+
+Christian Ramseyer (1):
+
+* Remove merge aritfacts and fix a typo [PR 1741](https://github.com/pgjdbc/pgjdbc/pull/1741) [3871bfd8](https://github.com/pgjdbc/pgjdbc/commit/3871bfd8ba6c37be7cffdd4959f24e00b5bc86d8)
+
+Dave Cramer (1):
+
+* Revert "fix: convert silent rollbacks into exception if application sends commit command [PR 1729](https://github.com/pgjdbc/pgjdbc/pull/1729)" (#1746) [14576f4b](https://github.com/pgjdbc/pgjdbc/commit/14576f4bca3a2484fd4f81a0d8276ae5cab9a419)
+
+Vladimir Sitnikov (1):
+
+* Revert "fix: add support for full names of data types [PR 1719](https://github.com/pgjdbc/pgjdbc/pull/1719)" [49d66e4e](https://github.com/pgjdbc/pgjdbc/commit/49d66e4ec0c514fbfa78cd72f7a8aeb742489fbd)
+
+<a name="contributors_{{ page.version }}"></a>
+### Contributors to this release
+
+We thank the following people for their contributions to this release.
+
+[Christian Ramseyer](https://github.com/rc9000)  
+[Dave Cramer](davec at postgresintl.com)  
+[Vladimir Sitnikov](https://github.com/vlsi)  


=====================================
docs/documentation/head/connect.md
=====================================
@@ -220,15 +220,6 @@ Connection conn = DriverManager.getConnection(url);
      
     The default is 'false'
 
-* **raiseExceptionOnSilentRollback** = boolean
-
-    since 42.2.11
-
-    Certain database versions perform a silent rollback instead of commit in case the transaction was in a failed state.
-    See https://www.postgresql.org/message-id/b9fb50dc-0f6e-15fb-6555-8ddb86f4aa71%40postgresfriends.org
-
-    The default is 'true'
-
 * **binaryTransfer** = boolean
 
 	Use binary format for sending and receiving data if possible.
@@ -568,12 +559,6 @@ And read pool balances connections between secondary nodes, but allows connectio
 
 `jdbc:postgresql://node1,node2,node3/accounting?targetServerType=preferSecondary&loadBalanceHosts=true`
 
-<<<<<<< HEAD
-If a slave fails, all slaves in the list will be tried first. If the case that there are no available slaves
-the master will be tried. If all of the servers are marked as "can't connect" in the cache then an attempt
-will be made to connect to all of the hosts in the URL in order.
-=======
-If a secondary fails, all secondaries in the list will be tried first. If the case that there are no available secondaries
+If a secondary fails, all secondaries in the list will be tried first. In the case that there are no available secondaries
 the primary will be tried. If all of the servers are marked as "can't connect" in the cache then an attempt
 will be made to connect to all of the hosts in the URL in order.
->>>>>>> 263d23605b9e4900fc161da165829a6b2ae168fc


=====================================
pgjdbc/pom.xml
=====================================
@@ -10,7 +10,7 @@
   <artifactId>postgresql</artifactId>
   <packaging>bundle</packaging>
   <name>PostgreSQL JDBC Driver - JDBC 4.2</name>
-  <version>42.2.11</version>
+  <version>42.2.12</version>
   <description>Java JDBC 4.2 (JRE 8+) driver for PostgreSQL database</description>
   <url>https://github.com/pgjdbc/pgjdbc</url>
 
@@ -364,6 +364,6 @@
   </build>
 
   <scm>
-    <tag>REL42.2.11</tag>
+    <tag>REL42.2.12</tag>
   </scm>
 </project>


=====================================
pgjdbc/src/main/java/org/postgresql/PGProperty.java
=====================================
@@ -407,14 +407,6 @@ public enum PGProperty {
     false,
     new String[] {"3"}),
 
-  /**
-   * Certain database versions perform a silent rollback instead of commit in case the transaction was in a failed state.
-   */
-  RAISE_EXCEPTION_ON_SILENT_ROLLBACK(
-    "raiseExceptionOnSilentRollback",
-    "true",
-    "Certain database versions perform a silent rollback instead of commit in case the transaction was in a failed state"),
-
   /**
    * Puts this connection in read-only mode.
    */


=====================================
pgjdbc/src/main/java/org/postgresql/core/QueryExecutor.java
=====================================
@@ -444,10 +444,6 @@ public interface QueryExecutor extends TypeTransferModeRegistry {
 
   boolean willHealOnRetry(SQLException e);
 
-  boolean isRaiseExceptionOnSilentRollback();
-
-  void setRaiseExceptionOnSilentRollback(boolean raiseExceptionOnSilentRollback);
-
   /**
    * By default, the connection resets statement cache in case deallocate all/discard all
    * message is observed.


=====================================
pgjdbc/src/main/java/org/postgresql/core/QueryExecutorBase.java
=====================================
@@ -48,7 +48,6 @@ public abstract class QueryExecutorBase implements QueryExecutor {
   private AutoSave autoSave;
   private boolean flushCacheOnDeallocate = true;
   protected final boolean logServerErrorDetail;
-  private boolean raiseExceptionOnSilentRollback;
 
   // default value for server versions that don't report standard_conforming_strings
   private boolean standardConformingStrings = false;
@@ -409,16 +408,6 @@ public abstract class QueryExecutorBase implements QueryExecutor {
     this.flushCacheOnDeallocate = flushCacheOnDeallocate;
   }
 
-  @Override
-  public boolean isRaiseExceptionOnSilentRollback() {
-    return raiseExceptionOnSilentRollback;
-  }
-
-  @Override
-  public void setRaiseExceptionOnSilentRollback(boolean raiseExceptionOnSilentRollback) {
-    this.raiseExceptionOnSilentRollback = raiseExceptionOnSilentRollback;
-  }
-
   protected boolean hasNotifications() {
     return notifications.size() > 0;
   }


=====================================
pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java
=====================================
@@ -67,7 +67,6 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import java.util.regex.Pattern;
 
 /**
  * QueryExecutor implementation for the V3 protocol.
@@ -76,23 +75,6 @@ public class QueryExecutorImpl extends QueryExecutorBase {
 
   private static final Logger LOGGER = Logger.getLogger(QueryExecutorImpl.class.getName());
   private static final String COPY_ERROR_MESSAGE = "COPY commands are only supported using the CopyManager API.";
-  private static final Pattern ROLLBACK_PATTERN = Pattern.compile("\\brollback\\b", Pattern.CASE_INSENSITIVE);
-  private static final Pattern COMMIT_PATTERN = Pattern.compile("\\bcommit\\b", Pattern.CASE_INSENSITIVE);
-  private static final Pattern PREPARE_PATTERN = Pattern.compile("\\bprepare ++transaction\\b", Pattern.CASE_INSENSITIVE);
-
-  private static boolean looksLikeCommit(String sql) {
-    if ("COMMIT".equalsIgnoreCase(sql)) {
-      return true;
-    }
-    if ("ROLLBACK".equalsIgnoreCase(sql)) {
-      return false;
-    }
-    return COMMIT_PATTERN.matcher(sql).find() && !ROLLBACK_PATTERN.matcher(sql).find();
-  }
-
-  private static boolean looksLikePrepare(String sql) {
-    return sql.startsWith("PREPARE TRANSACTION") || PREPARE_PATTERN.matcher(sql).find();
-  }
 
   /**
    * TimeZone of the current connection (TimeZone backend parameter).
@@ -373,6 +355,7 @@ public class QueryExecutorImpl extends QueryExecutorBase {
     if (((flags & QueryExecutor.QUERY_SUPPRESS_BEGIN) == 0
         || getTransactionState() == TransactionState.OPEN)
         && query != restoreToAutoSave
+        && !query.getNativeSql().equalsIgnoreCase("COMMIT")
         && getAutoSave() != AutoSave.NEVER
         // If query has no resulting fields, it cannot fail with 'cached plan must not change result type'
         // thus no need to set a savepoint before such query
@@ -2183,36 +2166,8 @@ public class QueryExecutorImpl extends QueryExecutorBase {
           SimpleQuery currentQuery = executeData.query;
           Portal currentPortal = executeData.portal;
 
-          String nativeSql = currentQuery.getNativeQuery().nativeSql;
-          // Certain backend versions (e.g. 12.2, 11.7, 10.12, 9.6.17, 9.5.21, etc)
-          // silently rollback the transaction in the response to COMMIT statement
-          // in case the transaction has failed.
-          // See discussion in pgsql-hackers: https://www.postgresql.org/message-id/b9fb50dc-0f6e-15fb-6555-8ddb86f4aa71%40postgresfriends.org
-          if (isRaiseExceptionOnSilentRollback()
-              && handler.getException() == null
-              && status.startsWith("ROLLBACK")) {
-            String message = null;
-            if (looksLikeCommit(nativeSql)) {
-              if (transactionFailCause == null) {
-                message = GT.tr("The database returned ROLLBACK, so the transaction cannot be committed. Transaction failure is not known (check server logs?)");
-              } else {
-                message = GT.tr("The database returned ROLLBACK, so the transaction cannot be committed. Transaction failure cause is <<{0}>>", transactionFailCause.getMessage());
-              }
-            } else if (looksLikePrepare(nativeSql)) {
-              if (transactionFailCause == null) {
-                message = GT.tr("The database returned ROLLBACK, so the transaction cannot be prepared. Transaction failure is not known (check server logs?)");
-              } else {
-                message = GT.tr("The database returned ROLLBACK, so the transaction cannot be prepared. Transaction failure cause is <<{0}>>", transactionFailCause.getMessage());
-              }
-            }
-            if (message != null) {
-              handler.handleError(
-                  new PSQLException(
-                      message, PSQLState.IN_FAILED_SQL_TRANSACTION, transactionFailCause));
-            }
-          }
-
           if (status.startsWith("SET")) {
+            String nativeSql = currentQuery.getNativeQuery().nativeSql;
             // Scan only the first 1024 characters to
             // avoid big overhead for long queries.
             if (nativeSql.lastIndexOf("search_path", 1024) != -1


=====================================
pgjdbc/src/main/java/org/postgresql/ds/common/BaseDataSource.java
=====================================
@@ -1461,22 +1461,6 @@ public abstract class BaseDataSource implements CommonDataSource, Referenceable
     PGProperty.AUTOSAVE.set(properties, autoSave.value());
   }
 
-  /**
-   * @return connection configuration regarding throwing exception from commit if database rolls back the transaction
-   * @see PGProperty#RAISE_EXCEPTION_ON_SILENT_ROLLBACK
-   */
-  public boolean isRaiseExceptionOnSilentRollback() {
-    return PGProperty.RAISE_EXCEPTION_ON_SILENT_ROLLBACK.getBoolean(properties);
-  }
-
-  /**
-   * @param raiseExceptionOnSilentRollback if the database should throw exception if commit silently rolls back
-   * @see PGProperty#RAISE_EXCEPTION_ON_SILENT_ROLLBACK
-   */
-  public void setRaiseExceptionOnSilentRollback(boolean raiseExceptionOnSilentRollback) {
-    PGProperty.RAISE_EXCEPTION_ON_SILENT_ROLLBACK.set(properties, raiseExceptionOnSilentRollback);
-  }
-
   /**
    * see PGProperty#CLEANUP_SAVEPOINTS
    *


=====================================
pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java
=====================================
@@ -247,10 +247,6 @@ public class PgConnection implements BaseConnection {
       LOGGER.log(Level.FINEST, "    integer date/time = {0}", queryExecutor.getIntegerDateTimes());
     }
 
-    queryExecutor.setRaiseExceptionOnSilentRollback(
-        PGProperty.RAISE_EXCEPTION_ON_SILENT_ROLLBACK.getBoolean(info)
-    );
-
     //
     // String -> text or unknown?
     //


=====================================
pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java
=====================================
@@ -77,11 +77,9 @@ public class TypeInfoCache implements TypeInfo {
       {"money", Oid.MONEY, Types.DOUBLE, "java.lang.Double", Oid.MONEY_ARRAY},
       {"numeric", Oid.NUMERIC, Types.NUMERIC, "java.math.BigDecimal", Oid.NUMERIC_ARRAY},
       {"float4", Oid.FLOAT4, Types.REAL, "java.lang.Float", Oid.FLOAT4_ARRAY},
-      {"double precision", Oid.FLOAT8, Types.DOUBLE, "java.lang.Double", Oid.FLOAT8_ARRAY},
       {"float8", Oid.FLOAT8, Types.DOUBLE, "java.lang.Double", Oid.FLOAT8_ARRAY},
       {"char", Oid.CHAR, Types.CHAR, "java.lang.String", Oid.CHAR_ARRAY},
       {"bpchar", Oid.BPCHAR, Types.CHAR, "java.lang.String", Oid.BPCHAR_ARRAY},
-      {"character varying", Oid.VARCHAR, Types.VARCHAR, "java.lang.String", Oid.VARCHAR_ARRAY},
       {"varchar", Oid.VARCHAR, Types.VARCHAR, "java.lang.String", Oid.VARCHAR_ARRAY},
       {"text", Oid.TEXT, Types.VARCHAR, "java.lang.String", Oid.TEXT_ARRAY},
       {"name", Oid.NAME, Types.VARCHAR, "java.lang.String", Oid.NAME_ARRAY},
@@ -90,13 +88,10 @@ public class TypeInfoCache implements TypeInfo {
       {"bit", Oid.BIT, Types.BIT, "java.lang.Boolean", Oid.BIT_ARRAY},
       {"date", Oid.DATE, Types.DATE, "java.sql.Date", Oid.DATE_ARRAY},
       {"time", Oid.TIME, Types.TIME, "java.sql.Time", Oid.TIME_ARRAY},
-      {"time without time zone", Oid.TIME, Types.TIME, "java.sql.Time", Oid.TIME_ARRAY},
       {"timetz", Oid.TIMETZ, Types.TIME, "java.sql.Time", Oid.TIMETZ_ARRAY},
-      {"time with time zone", Oid.TIMETZ, Types.TIME, "java.sql.Time", Oid.TIMETZ_ARRAY},
       {"timestamp", Oid.TIMESTAMP, Types.TIMESTAMP, "java.sql.Timestamp", Oid.TIMESTAMP_ARRAY},
-      {"timestamp without time zone", Oid.TIMESTAMP, Types.TIMESTAMP, "java.sql.Timestamp", Oid.TIMESTAMP_ARRAY},
-      {"timestamptz", Oid.TIMESTAMPTZ, Types.TIMESTAMP, "java.sql.Timestamp", Oid.TIMESTAMPTZ_ARRAY},
-      {"timestamp with time zone", Oid.TIMESTAMPTZ, Types.TIMESTAMP, "java.sql.Timestamp", Oid.TIMESTAMPTZ_ARRAY},
+      {"timestamptz", Oid.TIMESTAMPTZ, Types.TIMESTAMP, "java.sql.Timestamp",
+          Oid.TIMESTAMPTZ_ARRAY},
       //#if mvn.project.property.postgresql.jdbc.spec >= "JDBC4.2"
       {"refcursor", Oid.REF_CURSOR, Types.REF_CURSOR, "java.sql.ResultSet", Oid.REF_CURSOR_ARRAY},
       //#endif


=====================================
pgjdbc/src/main/java/org/postgresql/xa/PGXAConnection.java
=====================================
@@ -647,9 +647,6 @@ public class PGXAConnection extends PGPooledConnection implements XAConnection,
     if (isPostgreSQLIntegrityConstraintViolation(sqlException)) {
       return XAException.XA_RBINTEGRITY;
     }
-    if (PSQLState.IN_FAILED_SQL_TRANSACTION.getState().equals(sqlException.getSQLState())) {
-      return XAException.XA_RBOTHER;
-    }
 
     return XAException.XAER_RMFAIL;
   }


=====================================
pgjdbc/src/test/java/org/postgresql/test/jdbc2/ArrayTest.java
=====================================
@@ -30,8 +30,6 @@ import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.sql.Time;
-import java.sql.Timestamp;
 import java.sql.Types;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -174,65 +172,6 @@ public class ArrayTest extends BaseTest4 {
     rs.close();
   }
 
-  @Test
-  public void testSetArraysWithFullDataTypeNames() throws SQLException {
-    // Create a test table and insert arrays with data types identified by their full names
-    TestUtil.createTable(conn, "arrtest_fullnames", "floatarr double precision[], varchararr character varying(20)[], timearr time without time zone[], tzarr timestamp with time zone[]");
-
-    PreparedStatement pstmt = conn.prepareStatement("INSERT INTO arrtest_fullnames VALUES (?,?,?,?)");
-
-    final PGConnection arraySupport = conn.unwrap(PGConnection.class);
-
-    pstmt.setArray(1, arraySupport.createArrayOf("double precision", new Object[] { 1d, 2d, 3d }));
-    pstmt.setObject(2, arraySupport.createArrayOf("character varying", new String[] { "abc", "f'a", "fa\"b" }));
-    pstmt.setObject(3, arraySupport.createArrayOf("time without time zone", new Object[] { Time.valueOf("12:34:56"), Time.valueOf("03:30:25"), Time.valueOf("05:14:53") }));
-    pstmt.setObject(4, arraySupport.createArrayOf("timestamp with time zone", new Object[] { "1996-01-23 12:00:00-08", "1996-07-09 05:07:30+00", "1997-08-16 16:51:00-04" }));
-
-    pstmt.executeUpdate();
-    pstmt.close();
-
-    // Select the created record and ensure the returned data has the correct type and content
-    Statement stmt = conn.createStatement();
-    ResultSet rs = stmt.executeQuery("SELECT floatarr, varchararr, timearr, tzarr FROM arrtest_fullnames");
-    Assert.assertTrue(rs.next());
-
-    Array arr = rs.getArray(1);
-    Assert.assertEquals(Types.DOUBLE, arr.getBaseType());
-    Double[] doublearr = (Double[]) arr.getArray();
-    Assert.assertEquals(3, doublearr.length);
-    Assert.assertEquals(1d, doublearr[0].intValue(), 0);
-    Assert.assertEquals(2d, doublearr[1].intValue(), 0);
-    Assert.assertEquals(3d, doublearr[2].intValue(), 0);
-
-    arr = rs.getArray(2);
-    Assert.assertEquals(Types.VARCHAR, arr.getBaseType());
-    String[] varchararr = (String[]) arr.getArray();
-    Assert.assertEquals(3, varchararr.length);
-    Assert.assertEquals("abc", varchararr[0]);
-    Assert.assertEquals("f'a", varchararr[1]);
-    Assert.assertEquals("fa\"b", varchararr[2]);
-
-    arr = rs.getArray(3);
-    Assert.assertEquals(Types.TIME, arr.getBaseType());
-    Time[] timearr = (Time []) arr.getArray();
-    Assert.assertEquals(3, timearr.length);
-    Assert.assertEquals(Time.valueOf("12:34:56"), timearr[0]);
-    Assert.assertEquals(Time.valueOf("03:30:25"), timearr[1]);
-    Assert.assertEquals(Time.valueOf("05:14:53"), timearr[2]);
-
-    arr = rs.getArray(4);
-    Assert.assertEquals(Types.TIMESTAMP, arr.getBaseType());
-    Timestamp[] tzarr = (Timestamp[]) arr.getArray();
-    Assert.assertEquals(3, timearr.length);
-    Assert.assertEquals(822427200000L, tzarr[0].getTime());
-    Assert.assertEquals(836888850000L, tzarr[1].getTime());
-    Assert.assertEquals(871764660000L, tzarr[2].getTime());
-
-    rs.close();
-
-    TestUtil.dropTable(conn, "arrtest_fullnames");
-  }
-
   @Test
   public void testSetNullArrays() throws SQLException {
     PreparedStatement pstmt = conn.prepareStatement("INSERT INTO arrtest VALUES (?,?,?)");


=====================================
pgjdbc/src/test/java/org/postgresql/test/jdbc2/AutoRollbackTestSuite.java
=====================================
@@ -162,9 +162,6 @@ public class AutoRollbackTestSuite extends BaseTest4 {
   public void tearDown() throws SQLException {
     try {
       con.setAutoCommit(true);
-    } catch (Exception ignored) {
-    }
-    try {
       TestUtil.dropTable(con, "rollbacktest");
     } catch (Exception e) {
       e.printStackTrace();
@@ -295,46 +292,15 @@ public class AutoRollbackTestSuite extends BaseTest4 {
     switch (continueMode) {
       case COMMIT:
         try {
-          TransactionState transactionState = pgConnection.getTransactionState();
           doCommit();
-          Assert.assertNotEquals(
-              ".commit() should throw exception since the transaction was in failed state",
-                TransactionState.FAILED, transactionState);
-          Assert.assertEquals("Transaction should be IDLE after .commit()",
-              TransactionState.IDLE, pgConnection.getTransactionState());
-          // Commit might fail in case the transaction is in aborted state
+          // No assert here: commit should always succeed with exception of well known failure cases in catch
         } catch (SQLException e) {
-          if (!PSQLState.INVALID_SQL_STATEMENT_NAME.getState().equals(e.getSQLState())) {
-            // In preferQueryMode=extendedCacheEverything mode it might be that "commit"
-            // statement is using server-prepared mode, and it might result in
-            // ERROR: prepared statement "S_4" does not exist
-            try {
-              Assert.assertEquals("Transaction should be IDLE after .commit()",
-                  TransactionState.IDLE, pgConnection.getTransactionState());
-            } catch (AssertionError ae) {
-              ae.initCause(e);
-              throw ae;
-            }
-          }
-          if (PSQLState.IN_FAILED_SQL_TRANSACTION.getState().equals(e.getSQLState())
-              && (!flushCacheOnDeallocate && DEALLOCATES.contains(failMode)
-              || autoCommit == AutoCommit.NO)) {
-            // We have two cases here:
-            // 1) autocommit=false, so transaction was in progress, so it is expected that commit
-            //    fails with IN_FAILED_SQL_TRANSACTION
-            // 2) commit might fail due to <<ERROR: prepared statement "S_4" does not exist>>
-            //    However, if flushCacheOnDeallocate is false, then autosave can't really work, so
-            //    it is expected that commit fails
-            // Commit terminates the transaction, so "autosave" can't really "rollback"
-            return;
-          }
           if (!flushCacheOnDeallocate && DEALLOCATES.contains(failMode)
               && autoSave == AutoSave.NEVER) {
             Assert.assertEquals(
                 "flushCacheOnDeallocate is disabled, thus " + failMode + " should cause 'prepared statement \"...\" does not exist'"
                     + " error message is " + e.getMessage(),
                 PSQLState.INVALID_SQL_STATEMENT_NAME.getState(), e.getSQLState());
-            // Commit terminates the transaction, so "autosave" can't really "rollback"
             return;
           }
           throw e;


=====================================
pgjdbc/src/test/java/org/postgresql/test/jdbc2/BatchExecuteTest.java
=====================================
@@ -8,7 +8,6 @@ package org.postgresql.test.jdbc2;
 import org.postgresql.PGProperty;
 import org.postgresql.PGStatement;
 import org.postgresql.test.TestUtil;
-import org.postgresql.util.PSQLState;
 
 import org.junit.Assert;
 import org.junit.Test;
@@ -239,13 +238,13 @@ public class BatchExecuteTest extends BaseTest4 {
   }
 
   @Test
-  public void testSelectInBatchThrowsAutoCommit() throws Throwable {
+  public void testSelectInBatchThrowsAutoCommit() throws Exception {
     con.setAutoCommit(true);
     testSelectInBatchThrows();
   }
 
   @Test
-  public void testSelectInBatchThrows() throws Throwable {
+  public void testSelectInBatchThrows() throws Exception {
     Statement stmt = con.createStatement();
 
     int oldValue = getCol1Value();
@@ -262,13 +261,7 @@ public class BatchExecuteTest extends BaseTest4 {
     }
 
     if (!con.getAutoCommit()) {
-      try {
-        con.commit();
-      } catch (SQLException e) {
-        if (!PSQLState.IN_FAILED_SQL_TRANSACTION.getState().equals(e.getSQLState())) {
-          throw e;
-        }
-      }
+      con.commit();
     }
 
     int newValue = getCol1Value();


=====================================
pgjdbc/src/test/java/org/postgresql/test/jdbc2/BatchFailureTest.java
=====================================
@@ -7,7 +7,6 @@ package org.postgresql.test.jdbc2;
 
 import org.postgresql.PGProperty;
 import org.postgresql.test.TestUtil;
-import org.postgresql.util.PSQLState;
 
 import org.junit.Assert;
 import org.junit.Test;
@@ -243,14 +242,7 @@ public class BatchFailureTest extends BaseTest4 {
     }
 
     if (!con.getAutoCommit()) {
-      try {
-        // Commit might fail if the transaction is in aborted state
-        con.commit();
-      } catch (SQLException e) {
-        if (!PSQLState.IN_FAILED_SQL_TRANSACTION.getState().equals(e.getSQLState())) {
-          throw e;
-        }
-      }
+      con.commit();
     }
 
     int finalCount = getBatchUpdCount();


=====================================
pgjdbc/src/test/java/org/postgresql/test/jdbc2/Jdbc2TestSuite.java
=====================================
@@ -118,7 +118,6 @@ import org.junit.runners.Suite;
     TimeTest.class,
     TimezoneCachingTest.class,
     TimezoneTest.class,
-    TransactionTest.class,
     TypeCacheDLLStressTest.class,
     UpdateableResultTest.class,
     UpsertTest.class,


=====================================
pgjdbc/src/test/java/org/postgresql/test/jdbc2/MiscTest.java
=====================================
@@ -9,9 +9,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
 import org.postgresql.test.TestUtil;
-import org.postgresql.util.PSQLState;
 
-import org.junit.Assert;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -90,15 +88,7 @@ public class MiscTest {
       oos.close();
     }
 
-    try {
-      con.commit();
-    } catch (SQLException e) {
-      Assert.assertEquals(
-          "Transaction is in failed state, so .commit() should throw",
-          PSQLState.IN_FAILED_SQL_TRANSACTION.getState(),
-          e.getSQLState()
-      );
-    }
+    con.commit();
     con.close();
   }
 


=====================================
pgjdbc/src/test/java/org/postgresql/test/jdbc2/TransactionTest.java deleted
=====================================
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2020, PostgreSQL Global Development Group
- * See the LICENSE file in the project root for more information.
- */
-
-package org.postgresql.test.jdbc2;
-
-import org.postgresql.test.TestUtil;
-import org.postgresql.util.PSQLState;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.concurrent.Callable;
-
-public class TransactionTest extends BaseTest4 {
-  @Before
-  public void setUp() throws Exception {
-    super.setUp();
-    TestUtil.createTempTable(con, "transaction_test_table", "i int");
-    con.setAutoCommit(false);
-  }
-
-  @After
-  public void tearDown() throws SQLException {
-    con.setAutoCommit(true);
-    TestUtil.dropTable(con, "transaction_test_table");
-    super.tearDown();
-  }
-
-  private void setupTransaction() throws SQLException {
-    Statement st = con.createStatement();
-    st.execute("insert into transaction_test_table(i) values(42)");
-    try {
-      st.execute("invalid sql to abort transaction");
-    } catch (SQLException ignored) {
-    }
-    TestUtil.closeQuietly(st);
-  }
-
-  private void assertFails(Callable<Void> action) throws Exception {
-    String msg = "commit should fail since the transaction is in invalid state";
-    try {
-      action.call();
-      Assert.fail(msg);
-    } catch (SQLException e) {
-      try {
-        Assert.assertEquals(
-            msg,
-            PSQLState.IN_FAILED_SQL_TRANSACTION.getState(),
-            e.getSQLState()
-        );
-      } catch (AssertionError t) {
-        t.initCause(e);
-        throw t;
-      }
-    }
-  }
-
-  @Test
-  public void commitShouldFailIfTransactionWasInvalidState() throws Exception {
-    setupTransaction();
-    assertFails(new Callable<Void>() {
-      @Override
-      public Void call() throws Exception {
-        con.commit();
-        return null;
-      }
-    });
-  }
-
-  @Test
-  public void execute_commit_statement_ShouldFailIfTransactionWasInvalidState() throws Exception {
-    setupTransaction();
-    assertFails(new Callable<Void>() {
-      @Override
-      public Void call() throws Exception {
-        con.createStatement().execute("commit");
-        return null;
-      }
-    });
-  }
-
-  @Test
-  public void execute_CoMMiT_statement_ShouldFailIfTransactionWasInvalidState() throws Exception {
-    setupTransaction();
-    assertFails(new Callable<Void>() {
-      @Override
-      public Void call() throws Exception {
-        con.createStatement().execute("CoMMiT");
-        return null;
-      }
-    });
-  }
-
-  @Test
-  public void execute_CoMMiT_with_comments_statement_ShouldFailIfTransactionWasInvalidState() throws Exception {
-    setupTransaction();
-    assertFails(new Callable<Void>() {
-      @Override
-      public Void call() throws Exception {
-        con.createStatement().execute("/* Dear database, please save the data if possible, thanks */CoMMiT");
-        return null;
-      }
-    });
-  }
-
-  @Test
-  public void execute_rollback_with_comments_statement_should_not_fail() throws Exception {
-    setupTransaction();
-    // Note: there's rollback, so exception should not be there
-    con.createStatement().execute("/*adsf,commit*/rollBack/*CoMMiT,commit*/");
-  }
-
-  @Test
-  public void execute_rollback_statement_shouldsucceed() throws Exception {
-    setupTransaction();
-    con.createStatement().execute("rollback");
-  }
-
-  @Test
-  public void rolback_shouldsucceed() throws Exception {
-    setupTransaction();
-    con.rollback();
-  }
-
-  @Test
-  public void switch_to_autocommit_should_fail_because_it_does_implicit_commit() throws Exception {
-    setupTransaction();
-    assertFails(new Callable<Void>() {
-      @Override
-      public Void call() throws Exception {
-        con.setAutoCommit(true);
-        return null;
-      }
-    });
-  }
-}


=====================================
pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3SavepointTest.java
=====================================
@@ -9,10 +9,8 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
 import org.postgresql.test.TestUtil;
-import org.postgresql.util.PSQLState;
 
 import org.junit.After;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -36,15 +34,7 @@ public class Jdbc3SavepointTest {
 
   @After
   public void tearDown() throws SQLException {
-    try {
-      conn.setAutoCommit(true);
-    } catch (SQLException e) {
-      Assert.assertEquals(
-          "Unexpected exception from setAutoCommit(true)",
-          PSQLState.IN_FAILED_SQL_TRANSACTION.getState(),
-          e.getSQLState()
-      );
-    }
+    conn.setAutoCommit(true);
     TestUtil.dropTable(conn, "savepointtable");
     TestUtil.closeDB(conn);
   }


=====================================
pgjdbc/src/test/java/org/postgresql/test/xa/XAPrepareFailureTest.java deleted
=====================================
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2020, PostgreSQL Global Development Group
- * See the LICENSE file in the project root for more information.
- */
-
-package org.postgresql.test.xa;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-import org.postgresql.test.TestUtil;
-import org.postgresql.test.jdbc2.BaseTest4;
-import org.postgresql.test.jdbc2.optional.BaseDataSourceTest;
-import org.postgresql.xa.PGXADataSource;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.concurrent.Callable;
-
-import javax.sql.XAConnection;
-import javax.sql.XADataSource;
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
-
-public class XAPrepareFailureTest extends BaseTest4 {
-  private XADataSource xaDs;
-
-  private XAConnection xaconn;
-  private XAResource xaRes;
-  private Connection conn;
-  XADataSourceTest.CustomXid xid = new XADataSourceTest.CustomXid(7);
-
-  public XAPrepareFailureTest() {
-    xaDs = new PGXADataSource();
-    BaseDataSourceTest.setupDataSource((PGXADataSource) xaDs);
-  }
-
-  @Before
-  public void setUp() throws Exception {
-    super.setUp();
-    assumeTrue(isPreparedTransactionEnabled(con));
-
-    TestUtil.createTable(con, "xatransaction_test_table", "i int");
-
-    clearAllPrepared();
-    xaconn = xaDs.getXAConnection();
-    xaRes = xaconn.getXAResource();
-    conn = xaconn.getConnection();
-  }
-
-  @After
-  public void tearDown() throws SQLException {
-    TestUtil.dropTable(con, "xatransaction_test_table");
-    clearAllPrepared();
-    super.tearDown();
-  }
-
-  private static boolean isPreparedTransactionEnabled(Connection connection) throws SQLException {
-    Statement stmt = connection.createStatement();
-    ResultSet rs = stmt.executeQuery("SHOW max_prepared_transactions");
-    rs.next();
-    int mpt = rs.getInt(1);
-    rs.close();
-    stmt.close();
-    return mpt > 0;
-  }
-
-  private void clearAllPrepared() throws SQLException {
-    Statement st = con.createStatement();
-    try {
-      ResultSet rs = st.executeQuery(
-          "SELECT x.gid, x.owner = current_user "
-          + "FROM pg_prepared_xacts x "
-          + "WHERE x.database = current_database()");
-
-      Statement st2 = con.createStatement();
-      while (rs.next()) {
-        // TODO: This should really use org.junit.Assume once we move to JUnit 4
-        assertTrue("Only prepared xacts owned by current user may be present in db",
-            rs.getBoolean(2));
-        st2.executeUpdate("ROLLBACK PREPARED '" + rs.getString(1) + "'");
-      }
-      TestUtil.closeQuietly(st2);
-    } finally {
-      TestUtil.closeQuietly(st);
-    }
-  }
-
-  private XADataSourceTest.CustomXid setupTransaction() throws SQLException, XAException {
-    xaRes.start(xid, XAResource.TMNOFLAGS);
-    Statement st = conn.createStatement();
-    st.execute("insert into xatransaction_test_table(i) values(42)");
-    try {
-      st.execute("invalid sql to abort transaction");
-    } catch (SQLException ignored) {
-    }
-    TestUtil.closeQuietly(st);
-    return xid;
-  }
-
-  private void assertFails(Callable<Void> action) throws Exception {
-    String msg = "prepare transaction should fail since the transaction is in invalid state";
-    try {
-      action.call();
-      Assert.fail(msg);
-    } catch (XAException e) {
-      try {
-        Assert.assertEquals(msg, XAException.XA_RBOTHER, e.errorCode);
-      } catch (AssertionError t) {
-        t.initCause(e);
-        throw t;
-      }
-    }
-  }
-
-  @Test
-  public void prepareShouldFailIfTransactionWasInvalidState() throws Exception {
-    setupTransaction();
-    assertFails(new Callable<Void>() {
-      @Override
-      public Void call() throws Exception {
-        xaRes.end(xid, XAResource.TMSUCCESS);
-        xaRes.prepare(xid);
-        return null;
-      }
-    });
-  }
-
-  @Test
-  public void execute_rollback_statement_shouldsucceed() throws Exception {
-    setupTransaction();
-    xaRes.end(xid, XAResource.TMSUCCESS);
-    xaRes.rollback(xid);
-  }
-}


=====================================
pom.xml
=====================================
@@ -9,7 +9,7 @@
   <artifactId>pgjdbc-aggregate</artifactId>
   <packaging>pom</packaging>
   <name>PostgreSQL JDBC Driver aggregate</name>
-  <version>42.2.11</version>
+  <version>42.2.12</version>
   <description>PgJDBC aggregate project</description>
   <url>https://github.com/pgjdbc/pgjdbc</url>
 
@@ -22,7 +22,7 @@
     <url>https://github.com/pgjdbc/pgjdbc</url>
     <connection>scm:git:https://github.com/pgjdbc/pgjdbc.git</connection>
     <developerConnection>scm:git:git at github.com:pgjdbc/pgjdbc.git</developerConnection>
-    <tag>REL42.2.11</tag>
+    <tag>REL42.2.12</tag>
   </scm>
 
 </project>



View it on GitLab: https://salsa.debian.org/java-team/libpostgresql-jdbc-java/-/compare/bc711a0bdccfecd4acbe54657e94aed38215867a...fe00931177d93bf722c9289c4e030f6801faa928

-- 
View it on GitLab: https://salsa.debian.org/java-team/libpostgresql-jdbc-java/-/compare/bc711a0bdccfecd4acbe54657e94aed38215867a...fe00931177d93bf722c9289c4e030f6801faa928
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20200430/989cdd59/attachment.html>


More information about the pkg-java-commits mailing list