Repository: pgjdbc/pgjdbc
Pull request #1479 (2019-05-01 15:26:00)

Fix maven coordinates
### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing](https://github.com/pgjdbc/pgjdbc/blob/master/CONTRIBUTING.md) document?
* [ ] Have you checked to ensure there aren't other open [Pull Requests](../../pulls) for the same update/change?

<!-- You can erase any parts of this template not applicable to your Pull Request. -->

### New Feature Submissions:

1. [ ] Does your submission pass tests?
2. [ ] Does mvn checkstyle:check pass ?

### Changes to Existing Features:

* [ ] Does this break existing behaviour? If so please explain.
* [ ] Have you added an explanation of what your changes do and why you'd like us to include them?
* [ ] Have you written new tests for your core changes, as applicable?
* [ ] Have you successfully run tests with your changes locally?


AppVeyorBot: :white_check_mark: [Build pgjdbc 1.0.246 completed](https://ci.appveyor.com/project/davecramer/pgjdbc/builds/24233306) (commit https://github.com/pgjdbc/pgjdbc/commit/3218b8fe77 by @davecramer)
codecov-io: # [Codecov](https://codecov.io/gh/pgjdbc/pgjdbc/pull/1479?src=pr&el=h1) Report
> Merging [#1479](https://codecov.io/gh/pgjdbc/pgjdbc/pull/1479?src=pr&el=desc) into [master](https://codecov.io/gh/pgjdbc/pgjdbc/commit/95ba7b261e39754674c5817695ae5ebf9a341fae?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.



```diff
@@             Coverage Diff             @@
##             master   #1479      +/-   ##
===========================================
- Coverage     68.81%   68.8%   -0.01%     
+ Complexity     3931    3930       -1     
===========================================
  Files           179     179              
  Lines         16459   16459              
  Branches       2674    2674              
===========================================
- Hits          11326   11325       -1     
+ Misses         3888    3887       -1     
- Partials       1245    1247       +2
```


Patch:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 82287a7c..4821eb12 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -230,7 +230,7 @@ TL;DR:
 
     Note: the artifacts will not be visible in Maven Central before you manually release them.
 
-1. Navigate to [Sonatype Nexus Repository Manager](https://oss.sonatype.org/#stagingRepositories), find staging `orgpostgresql` repository there and release it
+1. Navigate to [Sonatype Nexus Repository Manager](https://oss.sonatype.org/#stagingRepositories), find staging `org.postgresql` repository there and release it
 
 ### Manual release procedure
 
diff --git a/pgjdbc/src/main/java/org/postgresql/core/PGStream.java b/pgjdbc/src/main/java/org/postgresql/core/PGStream.java
index 3f41803a..7ed6fc3e 100644
--- a/pgjdbc/src/main/java/org/postgresql/core/PGStream.java
+++ b/pgjdbc/src/main/java/org/postgresql/core/PGStream.java
@@ -423,8 +423,7 @@ public class PGStream implements Closeable, Flushable {
    * @throws IOException if a data I/O error occurs
    */
   public byte[][] receiveTupleV3() throws IOException, OutOfMemoryError {
-    // TODO: use msgSize
-    int msgSize = receiveInteger4();
+    receiveInteger4(); // MESSAGE SIZE
     int nf = receiveInteger2();
     byte[][] answer = new byte[nf][];
 
diff --git a/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java b/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java
index 8bfd65ee..f43bb78b 100644
--- a/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java
+++ b/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java
@@ -2413,7 +2413,7 @@ public class QueryExecutorImpl extends QueryExecutorBase {
    * Receive the field descriptions from the back end.
    */
   private Field[] receiveFields() throws IOException {
-    int msgSize = pgStream.receiveInteger4();
+    pgStream.receiveInteger4(); // MESSAGE SIZE
     int size = pgStream.receiveInteger2();
     Field[] fields = new Field[size];
 
@@ -2440,7 +2440,7 @@ public class QueryExecutorImpl extends QueryExecutorBase {
   }
 
   private void receiveAsyncNotify() throws IOException {
-    int msglen = pgStream.receiveInteger4();
+    pgStream.receiveInteger4(); // MESSAGE SIZE
     int pid = pgStream.receiveInteger4();
     String msg = pgStream.receiveString();
     String param = pgStream.receiveString();
@@ -2611,7 +2611,7 @@ public class QueryExecutorImpl extends QueryExecutorBase {
 
   public void receiveParameterStatus() throws IOException, SQLException {
     // ParameterStatus
-    int len = pgStream.receiveInteger4();
+    pgStream.receiveInteger4(); // MESSAGE SIZE
     String name = pgStream.receiveString();
     String value = pgStream.receiveString();
 
diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java b/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java
index 449aef03..65205f47 100644
--- a/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java
+++ b/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java
@@ -60,8 +60,9 @@ public final class EscapedFunctions2 {
     if (method != null) {
       return method;
     }
+    //FIXME: this probably should not use the US locale
     String nameLower = functionName.toLowerCase(Locale.US);
-    if (nameLower == functionName) {
+    if (nameLower.equals(functionName)) {
       // Input name was in lower case, the function is not there
       return null;
     }
diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/PgArray.java b/pgjdbc/src/main/java/org/postgresql/jdbc/PgArray.java
index d7668a03..b8b256a1 100644
--- a/pgjdbc/src/main/java/org/postgresql/jdbc/PgArray.java
+++ b/pgjdbc/src/main/java/org/postgresql/jdbc/PgArray.java
@@ -906,7 +906,8 @@ public class PgArray implements java.sql.Array {
 
         final PrimitiveArraySupport arraySupport = PrimitiveArraySupport.getArraySupport(array);
         if (arraySupport != null) {
-          fieldString = arraySupport.toArrayString(connection.getTypeInfo().getArrayDelimiter(oid), array);
+          fieldString =
+            arraySupport.toArrayString(connection.getTypeInfo().getArrayDelimiter(oid), array);
         } else {
           java.sql.Array tmpArray = connection.createArrayOf(getBaseTypeName(), (Object[]) array);
           fieldString = tmpArray.toString();
diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java b/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java
index caabfbcb..56d13506 100644
--- a/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java
+++ b/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java
@@ -1479,7 +1479,7 @@ public class PgDatabaseMetaData implements DatabaseMetaData {
     f[20] = new Field("SCOPE_TABLE", Oid.VARCHAR);
     f[21] = new Field("SOURCE_DATA_TYPE", Oid.INT2);
     f[22] = new Field("IS_AUTOINCREMENT", Oid.VARCHAR);
-    f[23] = new Field( "IS_GENERATED", Oid.VARCHAR);
+    f[23] = new Field( "IS_GENERATEDCOLUMN", Oid.VARCHAR);
 
     String sql;
     // a.attnum isn't decremented when preceding columns are dropped,
diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java b/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java
index 30e9f2a0..b0d4b51c 100644
--- a/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java
+++ b/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java
@@ -511,7 +511,7 @@ public class TimestampUtils {
     }
 
     // 2) Truncate date part so in given time zone the date would be formatted as 01/01/1970
-    return convertToTime(timeMillis, useCal == null ? null : useCal.getTimeZone());
+    return convertToTime(timeMillis, useCal.getTimeZone());
   }
 
   public synchronized Date toDate(Calendar cal, String s) throws SQLException {
@@ -1232,7 +1232,12 @@ public class TimestampUtils {
     if (tz == null) {
       tz = getDefaultTz();
     }
-    if (isSimpleTimeZone(tz.getID())) {
+    /*
+    the following math does not work for negative times
+    Punt and use Calendar for negative times.
+    This probably introduces a performance regression for times before 1970
+     */
+    if ( isSimpleTimeZone(tz.getID())) {
       // Truncate to 00:00 of the day.
       // Suppose the input date is 7 Jan 15:40 GMT+02:00 (that is 13:40 UTC)
       // We want it to become 7 Jan 00:00 GMT+02:00
@@ -1241,13 +1246,14 @@ public class TimestampUtils {
       millis += offset;
       // 2) Truncate hours, minutes, etc. Day is always 86400 seconds, no matter what leap seconds
       // are
-      millis = millis / ONEDAY * ONEDAY;
+      millis = floorDiv(millis, ONEDAY) * ONEDAY;
       // 2) Now millis is 7 Jan 00:00 UTC, however we need that in GMT+02:00, so subtract some
       // offset
       millis -= offset;
       // Now we have brand-new 7 Jan 00:00 GMT+02:00
       return new Date(millis);
     }
+
     Calendar cal = calendarWithUserTz;
     cal.setTimeZone(tz);
     cal.setTimeInMillis(millis);
@@ -1255,6 +1261,7 @@ public class TimestampUtils {
     cal.set(Calendar.MINUTE, 0);
     cal.set(Calendar.SECOND, 0);
     cal.set(Calendar.MILLISECOND, 0);
+
     return new Date(cal.getTimeInMillis());
   }
 
@@ -1362,7 +1369,7 @@ public class TimestampUtils {
         int years = (int) ((secs + 15773356800L) / -3155823050L);
         years++;
         years -= years / 4;
-        secs += years * 86400;
+        secs += years * 86400L;
       }
     }
 
@@ -1411,4 +1418,16 @@ public class TimestampUtils {
     }
     return TimeZone.getTimeZone(timeZone);
   }
+
+  /*
+  provide our own as this is not available until 1.8
+   */
+  public static long floorDiv(long x, long y) {
+    long r = x / y;
+    // if the signs are different and modulo not zero, round down
+    if ((x ^ y) < 0 && (r * y != x)) {
+      r--;
+    }
+    return r;
+  }
 }
diff --git a/pgjdbc/src/main/java/org/postgresql/largeobject/LargeObjectManager.java b/pgjdbc/src/main/java/org/postgresql/largeobject/LargeObjectManager.java
index 95b94714..bb7b156c 100644
--- a/pgjdbc/src/main/java/org/postgresql/largeobject/LargeObjectManager.java
+++ b/pgjdbc/src/main/java/org/postgresql/largeobject/LargeObjectManager.java
@@ -132,11 +132,6 @@ public class LargeObjectManager {
     Statement stmt = conn.createStatement();
     ResultSet res = stmt.executeQuery(sql);
 
-    if (res == null) { // NOSONAR
-      throw new PSQLException(GT.tr("Failed to initialize LargeObject API"),
-          PSQLState.SYSTEM_ERROR);
-    }
-
     fp.addFunctions(res);
     res.close();
     stmt.close();
diff --git a/pgjdbc/src/main/java/org/postgresql/replication/LogSequenceNumber.java b/pgjdbc/src/main/java/org/postgresql/replication/LogSequenceNumber.java
index 422ddc55..1886a7da 100644
--- a/pgjdbc/src/main/java/org/postgresql/replication/LogSequenceNumber.java
+++ b/pgjdbc/src/main/java/org/postgresql/replication/LogSequenceNumber.java
@@ -10,7 +10,7 @@ import java.nio.ByteBuffer;
 /**
  * LSN (Log Sequence Number) data which is a pointer to a location in the XLOG.
  */
-public final class LogSequenceNumber {
+public final class LogSequenceNumber implements Comparable<LogSequenceNumber> {
   /**
    * Zero is used indicate an invalid pointer. Bootstrap skips the first possible WAL segment,
    * initializing the first WAL page at XLOG_SEG_SIZE, so no XLOG record can begin at zero.
@@ -105,4 +105,14 @@ public final class LogSequenceNumber {
   public String toString() {
     return "LSN{" + asString() + '}';
   }
+
+  @Override
+  public int compareTo(LogSequenceNumber o) {
+    if (value == o.value) {
+      return 0;
+    }
+    //Unsigned comparison
+    return value + Long.MIN_VALUE < o.value + Long.MIN_VALUE ? -1 : 1;
+  }
+
 }
diff --git a/pgjdbc/src/main/java/org/postgresql/ssl/SingleCertValidatingFactory.java b/pgjdbc/src/main/java/org/postgresql/ssl/SingleCertValidatingFactory.java
index ff45925c..633aa680 100644
--- a/pgjdbc/src/main/java/org/postgresql/ssl/SingleCertValidatingFactory.java
+++ b/pgjdbc/src/main/java/org/postgresql/ssl/SingleCertValidatingFactory.java
@@ -142,7 +142,7 @@ public class SingleCertValidatingFactory extends WrappedFactory {
     }
   }
 
-  public class SingleCertTrustManager implements X509TrustManager {
+  public static class SingleCertTrustManager implements X509TrustManager {
     X509Certificate cert;
     X509TrustManager trustManager;
 
diff --git a/pgjdbc/src/main/java/org/postgresql/translation/messages_bg.java b/pgjdbc/src/main/java/org/postgresql/translation/messages_bg.java
index 3f4ea65c..6917b78f 100644
--- a/pgjdbc/src/main/java/org/postgresql/translation/messages_bg.java
+++ b/pgjdbc/src/main/java/org/postgresql/translation/messages_bg.java
@@ -188,8 +188,8 @@ public class messages_bg extends java.util.ResourceBundle {
     t[363] = "Времето за осъществяване на връзката изтече (таймаут).";
     t[364] = "Expected command status BEGIN, got {0}.";
     t[365] = "Очаквана команда BEGIN, получена {0}.";
-    t[366] = "Not implemented: 2nd phase commit must be issued using an idle connection. commit xid={0}, currentXid={1}, state={2], transactionState={3}";
-    t[367] = "Невъзможна комбинация: втората фаза на commit задължително трябва да бъде издадена при свободна връзка. commit xid={0}, currentXid={1}, state={2], transactionState={3}";
+    t[366] = "Not implemented: 2nd phase commit must be issued using an idle connection. commit xid={0}, currentXid={1}, state={2}, transactionState={3}";
+    t[367] = "Невъзможна комбинация: втората фаза на commit задължително трябва да бъде издадена при свободна връзка. commit xid={0}, currentXid={1}, state={2}, transactionState={3}";
     t[372] = "This copy stream is closed.";
     t[373] = "Потока за копиране на данните е затворен.";
     t[376] = "Can''t infer the SQL type to use for an instance of {0}. Use setObject() with an explicit Types value to specify the type to use.";
diff --git a/pgjdbc/src/main/java/org/postgresql/translation/messages_ja.java b/pgjdbc/src/main/java/org/postgresql/translation/messages_ja.java
index 41071cec..5dba5dad 100644
--- a/pgjdbc/src/main/java/org/postgresql/translation/messages_ja.java
+++ b/pgjdbc/src/main/java/org/postgresql/translation/messages_ja.java
@@ -312,8 +312,8 @@ public class messages_ja extends java.util.ResourceBundle {
     t[761] = "不正な server-first-message: {0}";
     t[762] = "No value specified for parameter {0}.";
     t[763] = "パラメータ {0} に値が設定されてません。";
-    t[764] = "Not implemented: 2nd phase commit must be issued using an idle connection. commit xid={0}, currentXid={1}, state={2], transactionState={3}";
-    t[765] = "実装されていません: 第二フェーズの COMMIT は、待機接続で使わなくてはなりません。xid={0}, currentXid={1}, state={2], transactionState={3}";
+    t[764] = "Not implemented: 2nd phase commit must be issued using an idle connection. commit xid={0}, currentXid={1}, state={2}, transactionState={3}";
+    t[765] = "実装されていません: 第二フェーズの COMMIT は、待機接続で使わなくてはなりません。xid={0}, currentXid={1}, state={2}, transactionState={3}";
     t[766] = "Fastpath call {0} - No result was returned and we expected an integer.";
     t[767] = "Fastpath 呼び出し {0} - integer を想定していましたが、結果は返却されませんでした。";
     t[774] = "Unable to create StAXResult for SQLXML";
diff --git a/pgjdbc/src/main/java/org/postgresql/translation/messages_pt_BR.java b/pgjdbc/src/main/java/org/postgresql/translation/messages_pt_BR.java
index 2c910605..1ebb0bd9 100644
--- a/pgjdbc/src/main/java/org/postgresql/translation/messages_pt_BR.java
+++ b/pgjdbc/src/main/java/org/postgresql/translation/messages_pt_BR.java
@@ -186,8 +186,8 @@ public class messages_pt_BR extends java.util.ResourceBundle {
     t[443] = "Zero bytes não podem ocorrer em parâmetros de cadeia de caracteres.";
     t[444] = "A result was returned when none was expected.";
     t[445] = "Um resultado foi retornado quando nenhum era esperado.";
-    t[446] = "Not implemented: 2nd phase commit must be issued using an idle connection. commit xid={0}, currentXid={1}, state={2], transactionState={3}";
-    t[447] = "Não está implementado: efetivação da segunda fase deve ser executada utilizado uma conexão ociosa. commit xid={0}, currentXid={1}, state={2], transactionState={3}";
+    t[446] = "Not implemented: 2nd phase commit must be issued using an idle connection. commit xid={0}, currentXid={1}, state={2}, transactionState={3}";
+    t[447] = "Não está implementado: efetivação da segunda fase deve ser executada utilizado uma conexão ociosa. commit xid={0}, currentXid={1}, state={2}, transactionState={3}";
     t[450] = "ResultSet is not updateable.  The query that generated this result set must select only one table, and must select all primary keys from that table. See the JDBC 2.1 API Specification, section 5.6 for more details.";
     t[451] = "ResultSet não é atualizável. A consulta que gerou esse conjunto de resultados deve selecionar somente uma tabela, e deve selecionar todas as chaves primárias daquela tabela. Veja a especificação na API do JDBC 2.1, seção 5.6 para obter mais detalhes.";
     t[454] = "Bind message length {0} too long.  This can be caused by very large or incorrect length specifications on InputStream parameters.";
diff --git a/pgjdbc/src/main/java/org/postgresql/translation/messages_ru.java b/pgjdbc/src/main/java/org/postgresql/translation/messages_ru.java
index 5b03c46e..976cd9b8 100644
--- a/pgjdbc/src/main/java/org/postgresql/translation/messages_ru.java
+++ b/pgjdbc/src/main/java/org/postgresql/translation/messages_ru.java
@@ -74,8 +74,8 @@ public class messages_ru extends java.util.ResourceBundle {
     t[147] = "Неожиданный статус команды COPY: {0}";
     t[148] = "Connection has been closed.";
     t[149] = "Это соединение уже было закрыто";
-    t[150] = "Not implemented: 2nd phase commit must be issued using an idle connection. commit xid={0}, currentXid={1}, state={2], transactionState={3}";
-    t[151] = "Духфазная фиксация работает только, если соединение неактивно (state=idle и транзакцция отсутствует). commit xid={0}, currentXid={1}, state={2], transactionState={3}";
+    t[150] = "Not implemented: 2nd phase commit must be issued using an idle connection. commit xid={0}, currentXid={1}, state={2}, transactionState={3}";
+    t[151] = "Духфазная фиксация работает только, если соединение неактивно (state=idle и транзакцция отсутствует). commit xid={0}, currentXid={1}, state={2}, transactionState={3}";
     t[160] = "The SSLSocketFactory class provided {0} could not be instantiated.";
     t[161] = "Невозможно создать SSLSocketFactory с помощью указанного класса {0}";
     t[164] = "The SocketFactory class provided {0} could not be instantiated.";
diff --git a/pgjdbc/src/main/java/org/postgresql/translation/messages_sr.java b/pgjdbc/src/main/java/org/postgresql/translation/messages_sr.java
index 5dc6e779..d18e6be0 100644
--- a/pgjdbc/src/main/java/org/postgresql/translation/messages_sr.java
+++ b/pgjdbc/src/main/java/org/postgresql/translation/messages_sr.java
@@ -186,8 +186,8 @@ public class messages_sr extends java.util.ResourceBundle {
     t[443] = "Nula bajtovji se ne smeju pojavljivati u string parametrima.";
     t[444] = "A result was returned when none was expected.";
     t[445] = "Rezultat vraćen ali nikakav rezultat nije očekivan.";
-    t[446] = "Not implemented: 2nd phase commit must be issued using an idle connection. commit xid={0}, currentXid={1}, state={2], transactionState={3}";
-    t[447] = "Nije implementirano: Dvofazni commit mora biti izdat uz korištenje besposlene konekcije. commit xid={0}, currentXid={1}, state={2], transactionState={3}";
+    t[446] = "Not implemented: 2nd phase commit must be issued using an idle connection. commit xid={0}, currentXid={1}, state={2}, transactionState={3}";
+    t[447] = "Nije implementirano: Dvofazni commit mora biti izdat uz korištenje besposlene konekcije. commit xid={0}, currentXid={1}, state={2}, transactionState={3}";
     t[450] = "ResultSet is not updateable.  The query that generated this result set must select only one table, and must select all primary keys from that table. See the JDBC 2.1 API Specification, section 5.6 for more details.";
     t[451] = "ResultSet nije moguće ažurirati. Upit koji je generisao ovaj razultat mora selektoati jedino tabelu,i mora selektovati sve primrne ključeve iz te tabele. Pogledajte API specifikaciju za JDBC 2.1, sekciju 5.6 za više detalja.";
     t[454] = "Bind message length {0} too long.  This can be caused by very large or incorrect length specifications on InputStream parameters.";
diff --git a/pgjdbc/src/main/java/org/postgresql/translation/messages_tr.java b/pgjdbc/src/main/java/org/postgresql/translation/messages_tr.java
index afceba6c..5b01e1ee 100644
--- a/pgjdbc/src/main/java/org/postgresql/translation/messages_tr.java
+++ b/pgjdbc/src/main/java/org/postgresql/translation/messages_tr.java
@@ -188,8 +188,8 @@ public class messages_tr extends java.util.ResourceBundle {
     t[443] = "String parametrelerinde sıfır bayt olamaz.";
     t[444] = "A result was returned when none was expected.";
     t[445] = "Hiçbir sonuç kebklenimezken sonuç getirildi.";
-    t[446] = "Not implemented: 2nd phase commit must be issued using an idle connection. commit xid={0}, currentXid={1}, state={2], transactionState={3}";
-    t[447] = "Desteklenmiyor: 2nd phase commit, atıl bir bağlantıdan başlatılmalıdır. commit xid={0}, currentXid={1}, state={2], transactionState={3}";
+    t[446] = "Not implemented: 2nd phase commit must be issued using an idle connection. commit xid={0}, currentXid={1}, state={2}, transactionState={3}";
+    t[447] = "Desteklenmiyor: 2nd phase commit, atıl bir bağlantıdan başlatılmalıdır. commit xid={0}, currentXid={1}, state={2}, transactionState={3}";
     t[450] = "ResultSet is not updateable.  The query that generated this result set must select only one table, and must select all primary keys from that table. See the JDBC 2.1 API Specification, section 5.6 for more details.";
     t[451] = "ResultSet değiştirilemez. Bu sonucu üreten sorgu tek bir tablodan sorgulamalı ve tablonun tüm primary key alanları belirtmelidir. Daha fazla bilgi için bk. JDBC 2.1 API Specification, section 5.6.";
     t[454] = "Bind message length {0} too long.  This can be caused by very large or incorrect length specifications on InputStream parameters.";
diff --git a/pgjdbc/src/main/java/org/postgresql/xa/PGXAConnection.java b/pgjdbc/src/main/java/org/postgresql/xa/PGXAConnection.java
index b23fbf23..a746f779 100644
--- a/pgjdbc/src/main/java/org/postgresql/xa/PGXAConnection.java
+++ b/pgjdbc/src/main/java/org/postgresql/xa/PGXAConnection.java
@@ -573,7 +573,7 @@ public class PGXAConnection extends PGPooledConnection implements XAConnection,
       if (state != State.IDLE
           || conn.getTransactionState() != TransactionState.IDLE) {
         throw new PGXAException(
-            GT.tr("Not implemented: 2nd phase commit must be issued using an idle connection. commit xid={0}, currentXid={1}, state={2], transactionState={3}", xid, currentXid, state, conn.getTransactionState()),
+            GT.tr("Not implemented: 2nd phase commit must be issued using an idle connection. commit xid={0}, currentXid={1}, state={2}, transactionState={3}", xid, currentXid, state, conn.getTransactionState()),
             XAException.XAER_RMERR);
       }
 


Test patch:
diff --git a/pgjdbc/src/test/java/org/postgresql/replication/LogSequenceNumberTest.java b/pgjdbc/src/test/java/org/postgresql/replication/LogSequenceNumberTest.java
index 30cd7747..abec6eb4 100644
--- a/pgjdbc/src/test/java/org/postgresql/replication/LogSequenceNumberTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/replication/LogSequenceNumberTest.java
@@ -96,4 +96,49 @@ public class LogSequenceNumberTest {
 
     assertThat(first.hashCode(), equalTo(second.hashCode()));
   }
+
+  @Test
+  public void testCompareToSameValue() throws Exception {
+    LogSequenceNumber first = LogSequenceNumber.valueOf("0/15D690F8");
+    LogSequenceNumber second = LogSequenceNumber.valueOf("0/15D690F8");
+
+    assertThat(first.compareTo(second), equalTo(0));
+    assertThat(second.compareTo(first), equalTo(0));
+  }
+
+  @Test
+  public void testCompareToPositiveValues() throws Exception {
+    LogSequenceNumber first = LogSequenceNumber.valueOf(1234);
+    LogSequenceNumber second = LogSequenceNumber.valueOf(4321);
+
+    assertThat(first.compareTo(second), equalTo(-1));
+    assertThat(second.compareTo(first), equalTo(1));
+  }
+
+  @Test
+  public void testCompareToNegativeValues() throws Exception {
+    LogSequenceNumber first = LogSequenceNumber.valueOf(0x8000000000000000L);
+    LogSequenceNumber second = LogSequenceNumber.valueOf(0x8000000000000001L);
+
+    assertThat(first.compareTo(second), equalTo(-1));
+    assertThat(second.compareTo(first), equalTo(1));
+  }
+
+  @Test
+  public void testCompareToMixedSign() throws Exception {
+    LogSequenceNumber first = LogSequenceNumber.valueOf(1);
+    LogSequenceNumber second = LogSequenceNumber.valueOf(0x8000000000000001L);
+
+    assertThat(first.compareTo(second), equalTo(-1));
+    assertThat(second.compareTo(first), equalTo(1));
+  }
+
+  @Test
+  public void testCompareToWithInvalid() throws Exception {
+    LogSequenceNumber first = LogSequenceNumber.INVALID_LSN;
+    LogSequenceNumber second = LogSequenceNumber.valueOf(1);
+
+    assertThat(first.compareTo(second), equalTo(-1));
+    assertThat(second.compareTo(first), equalTo(1));
+  }
 }
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
index 2097495f..0e3f6055 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
@@ -476,7 +476,7 @@ public class DatabaseMetaDataTest {
                                  "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE", "REMARKS",
                                  "COLUMN_DEF","SQL_DATA_TYPE","SQL_DATETIME_SUB","CHAR_OCTET_LENGTH",
                                  "ORDINAL_POSITION", "IS_NULLABLE", "SCOPE_CATALOG", "SCOPE_SCHEMA",
-                                 "SCOPE_TABLE", "SOURCE_DATA_TYPE", "IS_AUTOINCREMENT", "IS_GENERATED"};
+                                 "SCOPE_TABLE", "SOURCE_DATA_TYPE", "IS_AUTOINCREMENT", "IS_GENERATEDCOLUMN"};
 
     DatabaseMetaData dbmd = con.getMetaData();
     assertNotNull(dbmd);
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimestampTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimestampTest.java
index c6d71581..4ea1a4e2 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimestampTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimestampTest.java
@@ -47,6 +47,8 @@ public class TimestampTest extends BaseTest4 {
     setBinaryMode(binaryMode);
   }
 
+  private TimeZone currentTZ;
+
   @Parameterized.Parameters(name = "binary = {0}")
   public static Iterable<Object[]> data() {
     Collection<Object[]> ids = new ArrayList<Object[]>();
@@ -62,6 +64,7 @@ public class TimestampTest extends BaseTest4 {
     TestUtil.createTable(con, TSWTZ_TABLE, "ts timestamp with time zone");
     TestUtil.createTable(con, TSWOTZ_TABLE, "ts timestamp without time zone");
     TestUtil.createTable(con, DATE_TABLE, "ts date");
+    currentTZ = TimeZone.getDefault();
   }
 
   @Override
@@ -69,6 +72,7 @@ public class TimestampTest extends BaseTest4 {
     TestUtil.dropTable(con, TSWTZ_TABLE);
     TestUtil.dropTable(con, TSWOTZ_TABLE);
     TestUtil.dropTable(con, DATE_TABLE);
+    TimeZone.setDefault(currentTZ);
     super.tearDown();
   }
 
@@ -555,6 +559,22 @@ public class TimestampTest extends BaseTest4 {
     stmt.close();
   }
 
+  /*
+  Times before 1970 are negative in Java.
+  the convert to date does some math that assumes times are positive.
+  This test assures that the convertToDate still works properly with negative times
+   */
+  @Test
+  public void TestTimeStampBefore1970() {
+
+    TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+    TimestampUtils tsu = ((BaseConnection) con).getTimestampUtils();
+
+    Date date = tsu.convertToDate(Timestamp.valueOf("1969-01-10 12:00:00").getTime(), TimeZone.getDefault());
+
+    assertEquals(new GregorianCalendar(1969, Calendar.JANUARY, 10).getTime().getTime(), date.getTime() );
+  }
+
   /*
    * Helper for the TimestampTests. It tests what should be in the db
    */