COPY command, support for mixing binary and text columns?

Started by Stephen R. van den Bergalmost 18 years ago2 messageshackers
Jump to latest

Am I correct in the assumption that even though the network protocol
specifically allows individual columns of a copy command to be
binary or text format, the current COPY command in 8.3 doesn't
support specifying that?

Am I missing something in the network protocol which allows me
to specify it regardless of what the COPY command says?
--
Sincerely,
Stephen R. van den Berg.

In this signature, the concluding three words `were left out'.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Stephen R. van den Berg (#1)
Re: COPY command, support for mixing binary and text columns?

"Stephen R. van den Berg" <srb@cuci.nl> writes:

Am I correct in the assumption that even though the network protocol
specifically allows individual columns of a copy command to be
binary or text format, the current COPY command in 8.3 doesn't
support specifying that?

Yeah, the protocol is a bit more general than the actual file format.
The text COPY format really couldn't support mixed text and binary
fields at all, of course; and as for the binary format, the COPY
reference page says:

: Presently, all data values in a COPY BINARY file are assumed to be in
: binary format (format code one). It is anticipated that a future
: extension might add a header field that allows per-column format codes
: to be specified.

But it's been like that since PG 7.4, and no one's gotten motivated
to complete the feature, so don't hold your breath ;-)

AFAIK there are no client libraries that actually pay any attention to
the protocol's format codes anyway --- they just push the COPY data
through uninterpreted.

regards, tom lane