Re: raw output from copy - Mailing list pgsql-hackers

From Tom Lane
Subject Re: raw output from copy
Date
Msg-id 17552.1435849339@sss.pgh.pa.us
Whole thread Raw
In response to Re: raw output from copy  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: raw output from copy
Re: raw output from copy
Re: raw output from copy
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> Does the COPY line protocol even support binary data?

The protocol, per se, just transmits a byte stream.  There is a field
in the CopyInResponse/CopyOutResponse messages that indicates whether
a text or binary copy is being done.  One thing we'd have to consider
is whether "raw" mode is sufficiently different from binary to justify
an additional value for this field, and if so whether that constitutes
a protocol break.

IIRC, psql wouldn't really care; it just transfers the byte stream to or
from the target file, regardless of text or binary mode.  But there might
be other client libraries that are smarter and expect "binary" mode to
mean the binary file format specified in the COPY reference page.  So
there may be value in being explicit about "raw" mode in these messages.

A key point in all this is that people who need "raw" transfer probably
need it in both directions, a point that your SELECT proposal cannot
satisfy, but hacking COPY could.  So I lean towards the latter really.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: raw output from copy
Next
From: Sawada Masahiko
Date:
Subject: Re: Freeze avoidance of very large table.