Skip to content
Commits on Source (4)
root = true
[*]
insert_final_newline = true
[*.java]
indent_style = space
indent_size = 2
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
......@@ -8,11 +8,13 @@
**Describe the issue**
A clear and concise description of what the issue is.
**Java Version**
**Driver Version?**
**OS Version**
**Java Version?**
**PostgreSQL Version**
**OS Version?**
**PostgreSQL Version?**
**To Reproduce**
Steps to reproduce the behaviour:
......
### All Submissions:
* [ ] Have you followed the guidelines in our [Contributing](CONTRIBUTING.md) document?
* [ ] 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. -->
......
......@@ -94,6 +94,22 @@ matrix:
services:
- docker
if: type != pull_request
- jdk: openjdk-ea
sudo: required
addons:
postgresql: "10"
env:
- PG_VERSION=10
- JDK=12
- TZ=America/New_York # flips between −05:00 and −04:00
- jdk: oraclejdk11
sudo: required
addons:
postgresql: "10"
env:
- PG_VERSION=10
- JDK=11
- TZ=America/New_York # flips between −05:00 and −04:00
- jdk: oraclejdk9
addons:
postgresql: "9.6"
......@@ -156,7 +172,7 @@ matrix:
- MCENTRAL=Y
- COVERAGE=Y
- TZ=UTC
- jdk: openjdk6
- jdk: openjdk7
sudo: required
addons:
postgresql: "9.1"
......@@ -224,7 +240,7 @@ matrix:
- PG_VERSION=9.2
- ZULU_JDK=7
- stage: release_prev
jdk: openjdk6
jdk: openjdk7
sudo: required
addons:
postgresql: "9.1"
......
......@@ -3,7 +3,7 @@ set -x -e
if [ -z "$PG_VERSION" ]
then
echo "env PG_VERSION not define";
echo "env PG_VERSION not defined";
elif [ "x${PG_VERSION}" = "xHEAD" ]
then
PG_CTL="/usr/local/pgsql/bin/pg_ctl"
......@@ -19,11 +19,8 @@ sudo mkdir -p ${PG_SLAVE1_DATADIR}
sudo chmod 700 ${PG_SLAVE1_DATADIR}
sudo chown -R postgres:postgres ${PG_SLAVE1_DATADIR}
sudo su postgres -c "$PG_BASEBACKUP -Upostgres -D ${PG_SLAVE1_DATADIR} -X stream"
sudo su postgres -c "$PG_BASEBACKUP -Upostgres -D ${PG_SLAVE1_DATADIR} -X stream -R"
sudo su postgres -c "echo standby_mode = \'on\' >${PG_SLAVE1_DATADIR}/recovery.conf"
sudo su postgres -c "echo primary_conninfo = \'host=localhost port=5432 user=test password=test\' >>${PG_SLAVE1_DATADIR}/recovery.conf"
sudo su postgres -c "echo recovery_target_timeline = \'latest\' >>${PG_SLAVE1_DATADIR}/recovery.conf"
if [[ "x${PG_VERSION}" != "xHEAD" ]]
then
......@@ -38,6 +35,7 @@ then
sudo sed -i -e "/^[ \t]*hba_file.*/d" ${PG_SLAVE1_DATADIR}/postgresql.conf
sudo sed -i -e "/^[ \t]*ident_file.*/d" ${PG_SLAVE1_DATADIR}/postgresql.conf
sudo sed -i -e "s/^#\?hot_standby.*/hot_standby = on/g" ${PG_SLAVE1_DATADIR}/postgresql.conf
fi
#Start Slave 1
......@@ -50,25 +48,24 @@ sudo mkdir -p ${PG_SLAVE2_DATADIR}
sudo chmod 700 ${PG_SLAVE2_DATADIR}
sudo chown -R postgres:postgres ${PG_SLAVE2_DATADIR}
sudo su postgres -c "$PG_BASEBACKUP -Upostgres -D ${PG_SLAVE2_DATADIR} -X stream"
sudo su postgres -c "$PG_BASEBACKUP -Upostgres -D ${PG_SLAVE2_DATADIR} -X stream -R"
sudo su postgres -c "echo standby_mode = \'on\' >${PG_SLAVE2_DATADIR}/recovery.conf"
sudo su postgres -c "echo primary_conninfo = \'host=localhost port=5432 user=test password=test\' >>${PG_SLAVE2_DATADIR}/recovery.conf"
sudo su postgres -c "echo recovery_target_timeline = \'latest\' >>${PG_SLAVE2_DATADIR}/recovery.conf"
if [[ "x${PG_VERSION}" != "xHEAD" ]]
then
sudo su postgres -c "echo 'local all all trust' > ${PG_SLAVE2_DATADIR}/pg_hba.conf"
sudo su postgres -c "echo 'host all all 127.0.0.1/32 trust' >> ${PG_SLAVE2_DATADIR}/pg_hba.conf"
sudo su postgres -c "echo 'host all all ::1/128 trust' >> ${PG_SLAVE2_DATADIR}/pg_hba.conf"
sudo su postgres -c "touch ${PG_SLAVE2_DATADIR}/pg_ident.conf"
sudo su postgres -c "cp -f ${PG_DATADIR}/postgresql.conf ${PG_SLAVE2_DATADIR}/postgresql.conf"
sudo sed -i -e "/^[ \t]*data_directory.*/d" ${PG_SLAVE2_DATADIR}/postgresql.conf
sudo sed -i -e "/^[ \t]*hba_file.*/d" ${PG_SLAVE2_DATADIR}/postgresql.conf
sudo sed -i -e "/^[ \t]*ident_file.*/d" ${PG_SLAVE2_DATADIR}/postgresql.conf
sudo sed -i -e "s/^#\?hot_standby.*/hot_standby = on/g" ${PG_SLAVE2_DATADIR}/postgresql.conf
fi
#Start Slave 2
......
......@@ -10,7 +10,39 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
### Fixed
## [42.2.6] (2019-06-19)
### Known issues
- Microseconds in timestamps might be truncated when transferred in binary mode
- 24:00 time handling is not consistent [issue 1385](https://github.com/pgjdbc/pgjdbc/issues/1385)
- Unexpected packet type during stream replication [issue 1466](https://github.com/pgjdbc/pgjdbc/issues/1466)
- Driver goes missing after OSGi bundle restart [issue 1476](https://github.com/pgjdbc/pgjdbc/issues/1476)
### Changed
- Change IS_GENERATED to IS_GENERATEDCOLUMN as per spec [PR 1485](https://github.com/pgjdbc/pgjdbc/pull/1485)
- Fix missing metadata columns, and misspelled columns in PgDatabaseMetaData#getTables [PR 1323](https://github.com/pgjdbc/pgjdbc/pull/1323)
### Added
- CI tests with Java 11, and Java EA
- Support temporary replication slots in ReplicationCreateSlotBuilder [PR 1306](https://github.com/pgjdbc/pgjdbc/pull/1306)
- Support PostgreSQL 11, 12
- Return function (PostgreSQL 11) columns in PgDatabaseMetaData#getFunctionColumns
- Return information on create replication slot, now the snapshot_name is exported
to allow a consistent snapshot in some uses cases. [PR 1335](https://github.com/pgjdbc/pgjdbc/pull/1335)
### Fixed
- Fixed async copy performance (1ms per op) in SSL mode [PR 1314](https://github.com/pgjdbc/pgjdbc/pull/1314)
- Return Double.NaN for 'NaN'::numeric [PR 1304](https://github.com/pgjdbc/pgjdbc/pull/1304)
- Performance issue in PgDatabaseMetaData#getTypeInfo with lots of types in DB [PR 1302](https://github.com/pgjdbc/pgjdbc/pull/1302)
- PGCopyInputStream#read should cap values to [0, 255], -1 [PR 1349](https://github.com/pgjdbc/pgjdbc/pull/1349)
- Fixes LocalDateTime handling of BC dates [PR 1388](https://github.com/pgjdbc/pgjdbc/pull/1388)
- Release savepoints in autosave mode to prevent out of shared memory errors at the server side [PR 1409](https://github.com/pgjdbc/pgjdbc/pull/1409)
- Fix execution with big decimal in simple query mode. [PR 1463](https://github.com/pgjdbc/pgjdbc/pull/1463)
- Fix rounding for timestamps truncated to dates before 1970 [PR 1502](https://github.com/pgjdbc/pgjdbc/pull/1502)
## [42.2.5] (2018-08-27)
### Known issues
- 1ms per async copy call [issue 1312](https://github.com/pgjdbc/pgjdbc/issues/1312)
### Changed
- `ssl=true` implies `sslmode=verify-full`, that is it requires valid server certificate [cdeeaca4](https://github.com/pgjdbc/pgjdbc/commit/cdeeaca47dc3bc6f727c79a582c9e4123099526e)
......@@ -46,7 +78,7 @@ thrown to caller to be dealt with so no need to log at this verbosity by pgjdbc
### Fixed
- getString for PGObject-based types returned "null" string instead of null [PR 1154](https://github.com/pgjdbc/pgjdbc/pull/1154)
- Field metadata cache can be disabled via databaseMetadataCacheFields=0 [PR 1052](https://github.com/pgjdbc/pgjdbc/pull/1152)
- Field metadata cache can be disabled via databaseMetadataCacheFields=0 [PR 1052](https://github.com/pgjdbc/pgjdbc/pull/1052)
- Properly encode special symbols in passwords in BaseDataSource [PR 1201](https://github.com/pgjdbc/pgjdbc/pull/1201)
- Adjust date, hour, minute, second when rounding nanosecond part of a timestamp [PR 1212](https://github.com/pgjdbc/pgjdbc/pull/1212)
- perf: reduce memory allocations in query cache [PR 1227](https://github.com/pgjdbc/pgjdbc/pull/1227)
......@@ -186,4 +218,5 @@ thrown to caller to be dealt with so no need to log at this verbosity by pgjdbc
[42.2.3]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.2...REL42.2.3
[42.2.4]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.3...REL42.2.4
[42.2.5]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.4...REL42.2.5
[Unreleased]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.5...HEAD
[42.2.6]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.5...REL42.2.6
[Unreleased]: https://github.com/pgjdbc/pgjdbc/compare/REL42.2.6...HEAD
......@@ -178,7 +178,7 @@ It is recommended you run
mvn checkstyle:check
before creating your pull request
## Updating translations
......@@ -362,8 +362,10 @@ You can get old JDK versions from the [Oracle Java Archive](http://www.oracle.co
Then, to test against old JDK, run `mvn test` in `pgjdbc-jre6` or `pgjdbc-jre7` modules.
For information about the unit tests and how to run them, see
[org/postgresql/test/README](pgjdbc/src/test/java/org/postgresql/test/README.md)
An easy way to set up the test PostgreSQL database is to use [jackdb/pgjdbc-test-vm](https://github.com/jackdb/pgjdbc-test-vm). Follow the instructions on that project's [README](https://github.com/jackdb/pgjdbc-test-vm) page.
For more information about the unit tests and how to run them, see
[TESTING.md](TESTING.md)
## Support for IDEs
......
......@@ -5,6 +5,7 @@
PostgreSQL JDBC Driver (PgJDBC for short) allows Java programs to connect to a PostgreSQL database using standard, database independent Java code. Is an open source JDBC driver written in Pure Java (Type 4), and communicates in the PostgreSQL native network protocol.
### Status
[![Build status](https://ci.appveyor.com/api/projects/status/d8ucmegnmourohwu/branch/master?svg=true)](https://ci.appveyor.com/project/davecramer/pgjdbc/branch/master)
[![Build Status](https://travis-ci.org/pgjdbc/pgjdbc.svg?branch=master)](https://travis-ci.org/pgjdbc/pgjdbc)
[![codecov.io](http://codecov.io/github/pgjdbc/pgjdbc/coverage.svg?branch=master)](http://codecov.io/github/pgjdbc/pgjdbc?branch=master)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.postgresql/postgresql/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.postgresql/postgresql)
......@@ -23,36 +24,36 @@ Most people do not need to compile PgJDBC. You can download the precompiled driv
### Maven Central
You can search on The Central Repository with GroupId and ArtifactId [![Maven Search](https://img.shields.io/badge/org.postgresql-postgresql-yellow.svg)][mvn-search] for:
[![Java 8](https://img.shields.io/badge/Java_8-42.2.4-blue.svg)][mvn-jre8]
[![Java 8](https://img.shields.io/badge/Java_8-42.2.5-blue.svg)][mvn-jre8]
```xml
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.4</version>
<version>42.2.5</version>
</dependency>
```
[![Java 7](https://img.shields.io/badge/Java_7-42.2.4.jre7-blue.svg)][mvn-jre7]
[![Java 7](https://img.shields.io/badge/Java_7-42.2.5.jre7-blue.svg)][mvn-jre7]
```xml
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.4.jre7</version>
<version>42.2.5.jre7</version>
</dependency>
```
[![Java 6](https://img.shields.io/badge/Java_6-42.2.4.jre6-blue.svg)][mvn-jre6]
[![Java 6](https://img.shields.io/badge/Java_6-42.2.5.jre6-blue.svg)][mvn-jre6]
```xml
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.4.jre6</version>
<version>42.2.5.jre6</version>
</dependency>
```
[mvn-search]: http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.postgresql%22%20AND%20a%3A%22postgresql%22 "Search on Maven Central"
[mvn-jre6]: http://search.maven.org/#artifactdetails|org.postgresql|postgresql|42.2.4.jre6|bundle
[mvn-jre7]: http://search.maven.org/#artifactdetails|org.postgresql|postgresql|42.2.4.jre7|bundle
[mvn-jre8]: http://search.maven.org/#artifactdetails|org.postgresql|postgresql|42.2.4|bundle
[mvn-jre6]: http://search.maven.org/#artifactdetails|org.postgresql|postgresql|42.2.5.jre6|bundle
[mvn-jre7]: http://search.maven.org/#artifactdetails|org.postgresql|postgresql|42.2.5.jre7|bundle
[mvn-jre8]: http://search.maven.org/#artifactdetails|org.postgresql|postgresql|42.2.5|bundle
#### Development snapshots
Snapshot builds (builds from `master` branch) are also deployed to Maven Central, so you can test current development version (test some bugfix) using:
......@@ -60,9 +61,9 @@ Snapshot builds (builds from `master` branch) are also deployed to Maven Central
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.5-SNAPSHOT</version> <!-- Java 8 -->
<version>42.2.5.jre7-SNAPSHOT</version> <!-- Java 7 -->
<version>42.2.5.jre6-SNAPSHOT</version> <!-- Java 6 -->
<version>42.2.6-SNAPSHOT</version> <!-- Java 8 -->
<version>42.2.6.jre7-SNAPSHOT</version> <!-- Java 7 -->
<version>42.2.6.jre6-SNAPSHOT</version> <!-- Java 6 -->
</dependency>
```
......@@ -109,6 +110,7 @@ In addition to the standard connection parameters the driver supports a number o
| ----------------------------- | ------- | :-----: | ------------- |
| user | String | null | The database user on whose behalf the connection is being made. |
| password | String | null | The database user's password. |
| options | String | null | Specify 'options' connection initialization parameter. |
| ssl | Boolean | false | Control use of SSL (true value causes SSL to be required) |
| sslfactory | String | null | Provide a SSLSocketFactory class when using SSL. |
| sslfactoryarg (deprecated) | String | null | Argument forwarded to constructor of SSLSocketFactory class. |
......@@ -146,6 +148,7 @@ In addition to the standard connection parameters the driver supports a number o
| socketFactory | String | null | Specify a socket factory for socket creation |
| socketFactoryArg (deprecated) | String | null | Argument forwarded to constructor of SocketFactory class. |
| autosave | String | never | Specifies what the driver should do if a query fails, possible values: always, never, conservative |
| cleanupSavePoints | Boolean | false | In Autosave mode the driver sets a SAVEPOINT for every query. It is possible to exhaust the server shared buffers. Setting this to true will release each SAVEPOINT at the cost of an additional round trip. |
| preferQueryMode | String | extended | Specifies which mode is used to execute queries to database, possible values: extended, extendedForPrepared, extendedCacheEverything, simple |
| reWriteBatchedInserts | Boolean | false | Enable optimization to rewrite and collapse compatible INSERT statements that are batched. |
......
PostgreSQL/JDBC Test Suite Howto
================================
1 Introduction
2 Installation
3 Configuration
4 Running the test suite
5 Extending the test suite with new tests
6 Guidelines for developing new tests
7 Example
8 Running the JDBC 2 test suite from Sun against PostgreSQL
9 Credits, feedback
1 Introduction
--------------
# PostgreSQL/JDBC Test Suite Howto
## 1 - Introduction
The PostgreSQL source tree contains an automated test suite for
the JDBC driver. This document explains how to install,
configure and run this test suite. Furthermore, it offers
guidelines and an example for developers to add new test cases.
Sun provides two standard JDBC test suites that you may also
find useful.
http://java.sun.com/products/jdbc/download2.html (JDBC 1)
http://java.sun.com/products/jdbc/jdbctestsuite-1_2_1.html (JDBC
2, including J2EE requirements)
The JDBC 2 test suite is covered in section 8 below. The JDBC 1
test suite is not currently covered in this document.
2 Installation
--------------
Of course, you need to have a Java 2 JDK or JRE installed. The
standard JDK from Sun is OK. You can download it from
http://java.sun.com/.
You need to install the Ant build utility. You can download it
from http://jakarta.apache.org/ant/.
You also need to install the JUnit4 testing framework. You can
download it from http://www.junit.org/. Add junit4.jar to your
CLASSPATH before you perform the following steps. Ant will
dynamically detect that JUnit is present and then build the JDBC
test suite.
## 2 - Installation
Of course, you need to have a [Java 8 JDK](https://www.oracle.com/technetwork/java/javase/downloads/index.html). Also install [Apache Maven](https://maven.apache.org/).
You need to install and build the PostgreSQL JDBC driver source
tree. You can download it from http://jdbc.postgresql.org/. See
README in the top of the tree for more information.
tree. You can download it from https://github.com/pgjdbc/pgjdbc. See
[README](https://github.com/pgjdbc/pgjdbc) in that project for more information.
In this Howto we'll use $JDBC_SRC to refer to the top-level directory
of the JDBC driver source tree. The test suite is located in the
subdirectory $JDBC_SRC/org/postgresql/test.
In this Howto we'll use `$JDBC_SRC` to refer to the top-level directory
of the JDBC driver source tree. The test suite is the directory where you cloned the https://github.com/pgjdbc/pgjdbc project from GitHub.
## 3 Test PostgreSQL Database
3 Configuration
---------------
The test suite requires a PostgreSQL database to run the tests against
and a user to login as. The tests will create and drop many objects in
this database, so it should not contain production tables to avoid
loss of data. We recommend you assign the following names:
database: test
username: test
password: test
- database: test
- username: test
- password: test
If you have chosen other names you need to
create a file named `$JDBC_SRC/build.local.properties` and add your
customized values of the properties `database`, `username` and
`password`.
These names correspond with the default names set for the test suite
in $JDBC_SRC/build.xml. If you have chosen other names you need to
create a file named $JDBC_SRC/build.local.properties and add your
customized values of the properties "database", "username" and
"password".
An easy way to set up the test PostgreSQL database is to use [jackdb/pgjdbc-test-vm](https://github.com/jackdb/pgjdbc-test-vm). Follow the instructions on that project's [README](https://github.com/jackdb/pgjdbc-test-vm) page.
4 Running the test suite
------------------------
## 4 - Running the test suite
```sh
% cd $JDBC_SRC
%ant test
% mvn test
```
This will run the command line version of JUnit. If you'd like
to see an animated coloured progress bar as the tests are
......@@ -80,12 +53,11 @@ If the test suite reports errors or failures that you cannot
explain, please post the relevant parts of the output to the
mailing list pgsql-jdbc@postgresql.org.
5 Extending the test suite with new tests
-----------------------------------------
## 5 - Extending the test suite with new tests
If you're not familiar with JUnit, we recommend that you
first read the introductory article "JUnit Test Infected:
Programmers Love Writing Tests" on
http://junit.sourceforge.net/doc/testinfected/testing.htm.
first read the introductory article [JUnit Test Infected:
Programmers Love Writing Tests](http://junit.sourceforge.net/doc/testinfected/testing.htm).
Before continuing, you should ensure you understand the
following concepts: test suite, test case, test, fixture,
assertion, failure.
......@@ -104,15 +76,15 @@ In your test method you can use the fixture that is setup for it
by the test case.
If you decide to add a new test case, you should do two things:
1) Add a test class. It should
contain setUp() and tearDown() methods that create and destroy
1. Add a test class. It should
contain `setUp()` and `tearDown()` methods that create and destroy
the fixture respectively.
2) Edit $JDBC_SRC/org/postgresql/test/jdbc2/Jdbc2TestSuite.java or
$JDBC_SRC/org/postgresql/test/jdbc3/Jdbc3TestSuite.java and add your class. This will make the test case
2. Add your test class in `$JDBC_SRC/src/test/java/org/postgresql/test`. This will make the test case
part of the test suite.
6 Guidelines for developing new tests
-------------------------------------
## 6 - Guidelines for developing new tests
Every test should create and drop its own tables. We suggest to
consider database objects (e.g. tables) part of the fixture for
the tests in the test case. The test should also succeed when a
......@@ -122,13 +94,13 @@ The recommended pattern for creating and dropping tables can be
found in the example in section 7 below.
Please note that JUnit provides several convenience methods to
check for conditions. See the Assert class in the Javadoc
check for conditions. See the `Assert` class in the Javadoc
documentation of JUnit, which is installed on your system. For
example, you can compare two integers using
Assert.assertEquals(int expected, int actual). This method
`Assert.assertEquals(int expected, int actual)`. This method
will print both values in case of a failure.
To simply report a failure use Assert.fail().
To simply report a failure use `Assert.fail()`.
The JUnit FAQ explains how to test for a thrown exception.
......@@ -146,94 +118,21 @@ For example, in the comments you can explain where a certain test
condition originates from. Is it a JDBC requirement, PostgreSQL
behaviour or the intended implementation of a feature?
7 Example (incomplete)
----------------------
package org.postgresql.test.jdbc2;
import static org.junit.Assert.assertNotNull;
import org.postgresql.test.TestUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.sql.*;
/*
* Test case for ...
*/
public class FooTest {
private Connection con;
private Statement stmt;
@Before
public void setUp() throws Exception {
con = TestUtil.openDB();
stmt = con.createStatement();
// Drop the test table if it already exists for some
// reason. It is not an error if it doesn't exist.
try {
stmt.executeUpdate("DROP TABLE testfoo");
} catch (SQLException e) {
// Intentionally ignore. We cannot distinguish
// "table does not exist" from other errors, since
// PostgreSQL doesn't support error codes yet.
}
stmt.executeUpdate(
"CREATE TABLE testfoo(pk INTEGER, col1 INTEGER)");
stmt.executeUpdate("INSERT INTO testfoo VALUES(1, 0)");
// You may want to call con.setAutoCommit(false) at
// this point, if most tests in this test case require
// the use of transactions.
}
@After
public void tearDown() throws Exception {
con.setAutoCommit(true);
if (stmt != null) {
stmt.executeUpdate("DROP TABLE testfoo");
stmt.close();
}
if (con != null) {
TestUtil.closeDB(con);
}
}
@Test
public void testFoo() {
// Use the assert methods in import org.junit.Assert
// for the actual tests
// Just some silly examples
assertNotNull(con);
if (stmt == null) {
fail("Where is my statement?");
}
}
@Test
public void testBar() {
// Another test.
}
}
8 ssltests
----------------
- requires ssl to be turned on in the database 'postgresql.conf ssl=true'
- pg_hba.conf requires entries for hostssl, and hostnossl
## 7 - Example
See [BlobTest.java](https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/test/java/org/postgresql/test/jdbc2/BlobTest.java) for an example of a unit test that creates test table, runs a test, and then drops the table. There are other tests in [pgjdbc/src/test/java/org/postgresql](https://github.com/pgjdbc/pgjdbc/tree/master/pgjdbc/src/test/java/org/postgresql) which you can use an examples. Please add your own tests in this location.
## 8 - SSL tests
- requires SSL to be turned on in the database `postgresql.conf ssl=true`
- `pg_hba.conf` requires entries for `hostssl`, and `hostnossl`
- contrib module sslinfo needs to be installed in the databases
- databases certdb, hostdb, hostnossldb, hostssldb, and hostsslcertdb need to be created
- databases `certdb`, `hostdb`, `hostnossldb`, `hostssldb`, and `hostsslcertdb` need to be created
## 9 - Running the JDBC 2 test suite against PostgreSQL
9 Running the JDBC 2 test suite from Sun against PostgreSQL
------------------------------------------------------------
Download the test suite from
http://java.sun.com/products/jdbc/jdbctestsuite-1_2_1.html
Download the [JDBC test suite](http://java.sun.com/products/jdbc/jdbctestsuite-1_2_1.html).
This is the JDBC 2 test suite that includes J2EE requirements.
1. Configure PostgreSQL so that it accepts TCP/IP connections and
......@@ -303,8 +202,8 @@ This is the JDBC 2 test suite that includes J2EE requirements.
At the time of writing of this document, a great number of tests
in this test suite fail.
10 Credits, feedback
-------------------
## 10 - Credits and Feedback
The parts of this document describing the PostgreSQL test suite
were originally written by Rene Pijlman. Liam Stewart contributed
the section on the Sun JDBC 2 test suite.
......@@ -312,8 +211,3 @@ the section on the Sun JDBC 2 test suite.
Please send your questions about the JDBC test suites or suggestions
for improvement to the pgsql-jdbc@postgresql.org mailing list.
The source of this document is maintained in
org/postgresql/test/README in CVS. Patches for
improvement can be send to the mailing list
pgsql-jdbc@postgresql.org.
# appveyor.yml
image: Visual Studio 2015
configuration: Release
clone_depth: 1
environment:
PGUSER: postgres
PGPASSWORD: Password12!
matrix:
- pg: 9.4.19-1
PlatformToolset: v120
- pg: 9.5.15-1
PlatformToolset: v120
- pg: 9.6.11-1
PlatformToolset: v120
- pg: 10.6-1
PlatformToolset: v120
matrix:
allow_failures:
- pg: master
exclude:
- platform: x86
pg: 11.1-1
PlatformToolset: v140
- platform: x86
pg: master
init:
- set pf=%ProgramFiles%&& set x64=-x64
- set exe=postgresql-%pg%-windows%x64%.exe
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- ps: Add-Content "c:\program files\postgresql\9.6\data\postgresql.conf" "wal_level=logical"
- ps: Add-Content "c:\program files\postgresql\9.6\data\postgresql.conf" "max_wal_senders=3"
- ps: Add-Content "c:\program files\postgresql\9.6\data\postgresql.conf" "wal_keep_segments=10"
- ps: Add-Content "c:\program files\postgresql\9.6\data\postgresql.conf" "wal_sender_timeout=5s"
- ps: Add-Content "c:\program files\postgresql\9.6\data\postgresql.conf" "max_replication_slots=10"
- ps: Add-Content "c:\program files\postgresql\9.6\data\pg_hba.conf" "host replication all 127.0.0.1/32 trust"
branches:
except:
- /^tmp\/.*/
- /^REL.*/
services:
- postgresql96
install:
- for /f "tokens=1 delims=-" %%A in ("%pg%") do set pgversion=%%~nA
- echo pgversion=%pgversion%
- echo pf=%pf%
- set pgroot=%pf%\PostgreSQL\%pgversion%
- echo %pgroot%
- echo service=postgresql%x64%-%pgversion%
before_build:
- SET PATH=C:\Program Files\PostgreSQL\9.6\bin\;%PATH%
- ps: Add-Content -PATH "$env:pgroot\data\postgresql.conf" "wal_level=logical"
- ps: Add-Content -PATH "$env:pgroot\data\postgresql.conf" "max_wal_senders=3"
- ps: Add-Content -PATH "$env:pgroot\data\postgresql.conf" "wal_keep_segments=10"
- ps: Add-Content -PATH "$env:pgroot\data\postgresql.conf" "wal_sender_timeout=5s"
- ps: Add-Content -PATH "$env:pgroot\data\postgresql.conf" "max_replication_slots=10"
- ps: Add-Content -PATH "$env:pgroot\data\pg_hba.conf" "host replication all 127.0.0.1/32 trust"
- net start postgresql%x64%-%pgversion%
- path %pgroot%\bin;%PATH%
- SET PGUSER=postgres
- SET PGPASSWORD=Password12!
- createuser -U postgres test
......
# PostgreSQL backend protocol: wanted features
Current protocol is documented here: http://www.postgresql.org/docs/9.4/static/protocol.html
Current protocol is documented here: https://www.postgresql.org/docs/current/protocol.html
It turns out it lacks certain features, thus it makes clients more complex, slower, etc.
......
......@@ -5,10 +5,10 @@
server=localhost
port=5432
secondaryServer=localhost
secondaryPort=5433
secondaryServer1=localhost
secondaryPort1=5433
secondaryServer2=localhost
secondaryServerPort2=5434
secondaryPort2=5434
database=test
username=test
password=test
......
......@@ -13,7 +13,7 @@ In order to configure PostgreSQL for SSL tests, the following changes should be
* Set ssl_ca_file=root.crt in postgresql.conf
* Add databases for SSL tests. Note: sslinfo extension is used in tests to tell if connection is using SSL or not
for db in hostssldb hostnossldb certdb hostsslcertdb; do
for db in hostdb hostssldb hostnossldb certdb hostsslcertdb; do
createdb $db
psql $db -c "create extension sslinfo"
done
......@@ -36,9 +36,15 @@ openssl req -x509 -newkey rsa:1024 -days 3650 -nodes -keyout badroot.key -out ba
rm badroot.key
openssl pkcs8 -topk8 -in goodclient.key -out goodclient.pk8 -outform DER -v1 PBE-MD5-DES
openssl pkcs8 -topk8 -in badclient.key -out badclient.pk8 -outform DER -v1 PBE-MD5-DES
cp goodclient.crt server/root.crt
cd server
openssl req -x509 -newkey rsa:1024 -nodes -days 3650 -keyout server.key -out server.crt
cp server.crt ../goodroot.crt
#Common name is localhost, no password
{
"Adam Brusselback" : "https://github.com/Tostino",
"AlBundy33" : "https://github.com/AlBundy33",
"AlexElin" : "https://github.com/AlexElin",
"Alexander Kjäll" : "https://github.com/alexanderkjall",
"Andrew Guibert" : "https://github.com/aguibert",
"Barnabas Bodnar" : "https://github.com/bbodnar",
"Brett Okken" : "https://github.com/bokken",
"Brett Wooldridge" : "https://github.com/brettwooldridge",
......@@ -10,14 +12,19 @@
"Christian Ullrich" : "https://github.com/chrullrich",
"Christoph Berg" : "https://github.com/ChristophBerg",
"Christopher Deckers" : "https://github.com/Chrriis",
"Craig Ringer" : "https://github.com/ringerc",
"Daniel Gustafsson" : "https://github.com/danielgustafsson",
"Daniel Migowski" : "https://github.com/dmigowski",
"Dave Cramer" : "davec@postgresintl.com",
"Dmitriy Tseyler" : "https://github.com/tseylerd",
"Doug Mayer" : "https://github.com/doxavore",
"Eric McCormack" : "https://github.com/ericmack",
"Florin Asăvoaie" : "https://github.com/FlorinAsavoaie",
"George Kankava" : "https://github.com/georgekankava",
"Hari Babu Kommi" : "https://github.com/kommiharibabu",
"Harry Chan" : "https://github.com/hc-codersatlas",
"Hugh Cole-Baker" : "https://github.com/sigmaris",
"Ivan Leskin" : "https://github.com/leskin-in",
"JCzogalla" : "https://github.com/JCzogalla",
"Jacques Fuentes" : "https://github.com/jpfuentes2",
"James" : "https://github.com/jamesthomp",
......@@ -29,23 +36,31 @@
"Joe Kutner" : "https://github.com/jkutner",
"Jordan Lewis" : "https://github.com/jordanlewis",
"Jorge Solorzano" : "https://github.com/jorsol",
"Kamal Kumlien" : "https://github.com/kkumlien",
"Kazuhiro Sera" : "https://github.com/seratch",
"Kevin Wooten" : "https://github.com/kdubb",
"KimBisgaardDmi" : "https://github.com/KimBisgaardDmi",
"Krzysztof Szafrański" : "https://github.com/kszafran",
"Kyotaro Horiguchi" : "https://github.com/horiguti",
"Laurenz Albe" : "https://github.com/laurenz",
"Magnus" : "https://github.com/magJ",
"Magnus Hagander" : "https://github.com/mhagander",
"Marc Dean" : "https://github.com/deanmarc25",
"Marc Petzold" : "https://github.com/dosimeta",
"Marc Slemko" : "https://github.com/znep",
"Marios Trivyzas" : "https://github.com/matriv",
"Mark Nguyen" : "https://github.com/Mrk-Nguyen",
"Mathias Fußenegger" : "https://github.com/mfussenegger",
"Michael Glaesemann" : "https://github.com/grzm",
"MichaelZg" : "https://github.com/michaelzg",
"Michele Mancioppi" : "https://github.com/michele-mancioppi",
"Minglei Tu" : "https://github.com/tminglei",
"Mykola Nikishov" : "https://github.com/manandbytes",
"Nikolai Ivanov" : "https://github.com/nicktorwald",
"Pavel Raiskup" : "https://github.com/praiskup",
"Pawel" : "https://github.com/veselov",
"Petro Semeniuk" : "https://github.com/PetroSemeniuk",
"Philip Sanetra" : "https://github.com/PSanetra",
"Philippe Marschall" : "https://github.com/marschall",
"Piyush Sharma" : "https://github.com/ps-sp",
"Rikard Pavelic" : "https://github.com/zapov",
......@@ -59,9 +74,11 @@
"Simon Stelling" : "https://github.com/stellingsimon",
"Stephen Nelson" : "https://github.com/lordnelson",
"Steve Ungerer" : "https://github.com/scubasau",
"Sualeh Fatehi" : "https://github.com/sualeh",
"Tanya Gordeeva" : "https://github.com/tmgordeeva",
"Thach Hoang" : "https://github.com/thachhoang",
"Trygve Laugstøl" : "https://github.com/trygvis",
"Tyson Andre" : "https://github.com/TysonAndre",
"Vladimir Gordiychuk" : "https://github.com/Gordiychuk",
"Vladimir Sitnikov" : "https://github.com/vlsi",
"Zemian Deng" : "https://github.com/zemian",
......@@ -75,7 +92,13 @@
"djydewang" : "https://github.com/djydewang",
"eperez" : "https://github.com/eperez",
"goeland86" : "https://github.com/goeland86",
"itchyny" : "https://github.com/itchyny",
"jajalvipul" : "https://github.com/jajalvipul",
"kaiwangchen" : "https://github.com/kaiwangchen",
"kazachka" : "https://github.com/kazachka",
"maltalex" : "https://github.com/maltalex",
"mjanczykowski" : "https://github.com/mjanczykowski",
"pbillen" : "https://github.com/pbillen",
"rnveach" : "https://github.com/rnveach",
"slmsbrhgn" : "https://github.com/slmsbrhgn",
"trtrmitya" : "https://github.com/trtrmitya",
......
libpgjava (42.2.6-1) UNRELEASED; urgency=medium
* New upstream version.
* Add debian/gitlab-ci.yml.
-- Christoph Berg <myon@debian.org> Sat, 27 Jul 2019 23:11:05 +0200
libpgjava (42.2.5-2) unstable; urgency=medium
* Update PostgreSQL Maintainers address.
......
include:
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
reprotest:
extends: .test-reprotest-diffoscope
......@@ -6,7 +6,7 @@ Forwarded: not-needed
@@ -34,6 +34,20 @@
<jdbc.specification.version.nodot>42</jdbc.specification.version.nodot>
<skip.assembly>false</skip.assembly>
<checkstyle.version>8.5</checkstyle.version>
<checkstyle.version>[8.18,)</checkstyle.version>
+
+ <!-- Properties from pgjdbc-versions 1.1.2 -->
+ <postgresql.driver.fullversion>PostgreSQL ${postgresql.jdbc.spec}</postgresql.driver.fullversion>
......@@ -24,7 +24,7 @@ Forwarded: not-needed
</properties>
<dependencies>
@@ -249,6 +263,110 @@
@@ -232,6 +246,110 @@
<build>
<plugins>
<plugin>
......
......@@ -13,7 +13,7 @@ version: 42.0.0
- Add support for PreparedStatement.setCharacterStream(int, Reader). [ee4c4265](https://github.com/pgjdbc/pgjdbc/commit/ee4c4265aebc1c73a1d1fabac5ba259d1fbfd1e4)
### Changed
- Version bumped to 42.0.0 to avoid version clash with PostgreSQL version and follow a better sematic versioning. [46634923](https://github.com/pgjdbc/pgjdbc/commit/466349236622c6b03bb9cd8d7f517c3ce0586751)
- Version bumped to 42.0.0 to avoid version clash with PostgreSQL version and follow a better semantic versioning. [46634923](https://github.com/pgjdbc/pgjdbc/commit/466349236622c6b03bb9cd8d7f517c3ce0586751)
- Ensure executeBatch() can be used with pgbouncer. Previously pgjdbc could use server-prepared statements for batch execution even with prepareThreshold=0. [Issue 742](https://github.com/pgjdbc/pgjdbc/issues/742)
- Error position is displayed when SQL has unterminated literals, comments, etc. [Issue 688](https://github.com/pgjdbc/pgjdbc/issues/688)
- Strict handling of accepted values in getBoolean and setObject(BOOLEAN), now it follows PostgreSQL accepted values, only 1 and 0 for numeric types are acepted (previusly !=0 was true). [PR 732](https://github.com/pgjdbc/pgjdbc/pull/732)
......
......@@ -22,7 +22,7 @@ version: 42.2.0
### Changed
- Improve behaviour of ResultSet.getObject(int, Class). [PR 932](https://github.com/pgjdbc/pgjdbc/pull/932)
- Parse CommandComplete message using a regular expresion, allows complete catch of server returned commands for INSERT, UPDATE, DELETE, SELECT, FETCH, MOVE, COPY and future commands. [PR 962](https://github.com/pgjdbc/pgjdbc/pull/962)
- Parse CommandComplete message using a regular expression, allows complete catch of server returned commands for INSERT, UPDATE, DELETE, SELECT, FETCH, MOVE, COPY and future commands. [PR 962](https://github.com/pgjdbc/pgjdbc/pull/962)
- Use 'time with timezone' and 'timestamp with timezone' as is and ignore the user provided Calendars, 'time' and 'timestamp' work as earlier except "00:00:00" now maps to 1970-01-01 and "24:00:00" uses the system provided Calendar ignoring the user-provided one [PR 1053](https://github.com/pgjdbc/pgjdbc/pull/1053)
- Change behaviour of multihost connection. The new behaviour is to try all secondaries first before trying the master [PR 844](https://github.com/pgjdbc/pgjdbc/pull/844).
- Avoid reflective access to TimeZone.defaultTimeZone in Java 9+ [PR 1002](https://github.com/pgjdbc/pgjdbc/pull/1002) fixes [Issue 986](https://github.com/pgjdbc/pgjdbc/issues/986)
......
......@@ -18,7 +18,7 @@ version: 42.2.3
### Fixed
- getString for PGObject-based types returned "null" string instead of null [PR 1154](https://github.com/pgjdbc/pgjdbc/pull/1154)
- Field metadata cache can be disabled via databaseMetadataCacheFields=0 [PR 1052](https://github.com/pgjdbc/pgjdbc/pull/1152)
- Field metadata cache can be disabled via databaseMetadataCacheFields=0 [PR 1052](https://github.com/pgjdbc/pgjdbc/pull/1052)
- Properly encode special symbols in passwords in BaseDataSource [PR 1201](https://github.com/pgjdbc/pgjdbc/pull/1201)
- Adjust date, hour, minute, second when rounding nanosecond part of a timestamp [PR 1212](https://github.com/pgjdbc/pgjdbc/pull/1212)
- perf: reduce memory allocations in query cache [PR 1227](https://github.com/pgjdbc/pgjdbc/pull/1227)
......