Make sure we wait for protocol-level EOF when ending binary COPY IN.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 18 Sep 2010 20:10:15 +0000 (20:10 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 18 Sep 2010 20:10:15 +0000 (20:10 +0000)
commitf906e0786e27ca5b56a680c16b216ae406fbb1cf
treeaf6d0540f5eeaf3b1d885af8cd2cd37582c5f2ec
parentaf0161e5273a8b81cc76d6267ce9a7079268fe4a
Make sure we wait for protocol-level EOF when ending binary COPY IN.

The previous coding just terminated the COPY immediately after seeing
the EOF marker (-1 where a row field count is expected).  The expected
CopyDone or CopyFail message just got thrown away later, since we weren't
in COPY mode anymore.  This behavior complicated matters for the JDBC
driver, and arguably was the wrong thing in any case since a CopyFail
message after the marker wouldn't be honored.

Note that there is a behavioral change here: extra data after the EOF
marker was silently ignored before, but now it will cause an error.
Hence not back-patching, although this is arguably a bug.

Per report and patch by Kris Jurka.
src/backend/commands/copy.c