pgsql: Make sure we wait for protocol-level EOF when ending binary COPY

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Make sure we wait for protocol-level EOF when ending binary COPY
Date: 2010-09-18 20:10:16
Message-ID: 20100918201016.24BF77541E5@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
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.

Modified Files:
--------------
pgsql/src/backend/commands:
copy.c (r1.329 -> r1.330)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/copy.c?r1=1.329&r2=1.330)

Browse pgsql-committers by date

  From Date Subject
Next Message Josh Berkus 2010-09-18 21:42:08 Re: Configuring synchronous replication
Previous Message Robert Haas 2010-09-18 19:59:34 Re: Configuring synchronous replication