On Fri, Apr 1, 2016 at 8:42 AM, Daniel Verite <dan...@manitou-mail.org>

>         Andrew Dunstan wrote:
> > If someone can make a good case that this is going to be of
> > general use I'll happily go along, but I haven't seen one so far.
> About COPY FROM with a raw format, for instance just yesterday
> there was this user question on stackoverflow:
> http://stackoverflow.com/questions/36317237
> which essentially is: how to import contents from a file without any
> particular interpretation of any character?
> With the patch discussed in this thread, a user can do
> \copy table(textcol) from /path/to/file (format raw)

​What is needed to solve this specific use-case is a way to specify "QUOTE
NONE" instead of the default for whatever format is being hijacked:

​COPY file_content FROM '/tmp/textfile.txt' WITH (FORMAT csv, QUOTE
E'<unprintable character that should never appear in the data>');


COPY file_content FROM '/tmp/textfile.txt' WITH (FORMAT csv, QUOTE NONE);

​Or maybe: "WITH (FORMAT single_column)"

Though maybe that doesn't extend well to unencoded binary data...which
seems like it can be considered a separate problem from reliably importing
an entire file into a single row+column in a table.

David J.

Reply via email to