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

From tgl@postgresql.org (Tom Lane)
Subject pgsql: Make sure we wait for protocol-level EOF when ending binary COPY
Date
Msg-id 20100918201016.24BF77541E5@cvs.postgresql.org
Whole thread Raw
List 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)

pgsql-committers by date:

Previous
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Give a suitable HINT when an INSERT's data source is a RowExpr
Next
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Fix several broken $PostgreSQL$ keywords.