Re: raw output from copy
От | David G. Johnston |
---|---|
Тема | Re: raw output from copy |
Дата | |
Msg-id | CAKFQuwbJUVYkdbcOZh0zCCU73M_5t+Eix9UHVn-2+baBJ_Uj+A@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: raw output from copy ("Daniel Verite" <daniel@manitou-mail.org>) |
Список | pgsql-hackers |
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.
В списке pgsql-hackers по дате отправления: