[pgjdbc/pgjdbc] dbb30a: Fix PGCopyOutputStream out of order writes (#1854)

From: Sehrope Sarkuni <noreply(at)github(dot)com>
To: pgsql-jdbc(at)lists(dot)postgresql(dot)org
Subject: [pgjdbc/pgjdbc] dbb30a: Fix PGCopyOutputStream out of order writes (#1854)
Date: 2020-11-12 14:03:13
Message-ID: pgjdbc/pgjdbc/push/refs/heads/master/375cb3-dbb30a@github.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Branch: refs/heads/master
Home: https://github.com/pgjdbc/pgjdbc
Commit: dbb30af18e2dccb6e49040dd3108245935605340
https://github.com/pgjdbc/pgjdbc/commit/dbb30af18e2dccb6e49040dd3108245935605340
Author: Sehrope Sarkuni <sehrope(at)jackdb(dot)com>
Date: 2020-11-12 (Thu, 12 Nov 2020)

Changed paths:
M pgjdbc/src/main/java/org/postgresql/copy/PGCopyOutputStream.java
M pgjdbc/src/test/java/org/postgresql/test/TestUtil.java
M pgjdbc/src/test/java/org/postgresql/test/jdbc2/CopyTest.java

Log Message:
-----------
Fix PGCopyOutputStream out of order writes (#1854)

* test: Add TestUtil.queryForString(...) helper

Adds a helper method to execute a query and reads a single text column as a string.

* test: Add failing test for interleaved usage of PGCopyOutputStream APIs

Adds a failing test that writes to a PGCopyOutputStream using both the write(byte[])
and write(ByteStreamWriter) APIs to catch internal buffering breaking the order.

* fix: Flush PGCopyOutputStream internal buffer before writing via ByteStreamWriter

Fixes out of order writes when interleaving writes using buffered write(byte[]) and
writeToCopy(ByteStreamWriter) APIs.

Browse pgsql-jdbc by date

  From Date Subject
Next Message Hugo Abreu 2020-11-12 14:05:46 [pgjdbc/pgjdbc] 7e2cd5: isValid() timeout should not be blocked (#1943)
Previous Message MMeent 2020-11-11 15:50:41 [pgjdbc/pgjdbc] 375cb3: Fix: Rework sql type gathering to use OID instead ...