From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Daniel Verite <daniel(at)manitou-mail(dot)org> |
Cc: | Andrew Dunstan <andrew(at)dunslane(dot)net>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, hlinnaka <hlinnaka(at)iki(dot)fi>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Pavel Golub <pavel(at)microolap(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com> |
Subject: | Re: raw output from copy |
Date: | 2016-04-04 17:28:39 |
Message-ID: | CAKFQuwbJUVYkdbcOZh0zCCU73M_5t+Eix9UHVn-2+baBJ_Uj+A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Apr 1, 2016 at 8:42 AM, Daniel Verite <daniel(at)manitou-mail(dot)org>
wrote:
> 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>');
becomes
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2016-04-04 17:44:22 | Re: SSL indicator in psql prompt |
Previous Message | Tom Lane | 2016-04-04 16:55:46 | Re: raw output from copy |