diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml index f0b2145208..fdd9c5cf0c 100644 --- a/doc/src/sgml/protocol.sgml +++ b/doc/src/sgml/protocol.sgml @@ -1154,6 +1154,22 @@ SELCT 1/0; (if successful) or ErrorResponse (if not). + + + Version 2.0 of the PostgreSQL protocol + requires the sender to terminate the COPY data stream + with a final \. line. In the v3.0 protocol, use of + the terminating line is deprecated and made optional. The 3.0 + protocol now encapsulates the data into CopyData messages and terminates + the data stream with a CopyDone message. If the terminating line is + present, it must appear immediately before the CopyDone message. + Any code that fully implements version 3.0 of the copy-in/copy-out + sub-protocol should not send the terminating line but must allow + for the terminating line when receiving COPY + data. The terminating line will be removed from a future protocol version. + + + In the event of a backend-detected error during copy-in mode (including receipt of a CopyFail message), the backend will issue an ErrorResponse @@ -3928,7 +3944,11 @@ CopyData (F & B) Data that forms part of a COPY data stream. Messages sent from the backend will always correspond to single data rows, but messages sent by frontends might divide the data stream - arbitrarily. + arbitrarily. The last CopyData message before CopyDone may contain an optional + termination line containing \.. This termination line is + a holdover from the V2.0 protocol. It is not part of the data stream and should + be ignored. See the description of the COPY sub-protocol + message flow for more detail.