Обсуждение: \COPY from CSV ERROR: unterminated CSV quoted field

Поиск
Список
Период
Сортировка

\COPY from CSV ERROR: unterminated CSV quoted field

От
ogromm
Дата:
Hi,

I get the error "unterminated CSV quoted field" when I try to copy text with
"new line \. new line"


For example:

CREATE TABLE test (text TEXT);
\COPY test FROM 'test.csv' WITH DELIMITER ',' CSV HEADER;

test.csv:
Text
"some text
\.
more text"


Can any one please give me some clue how to get rid of this problem.

Thanks in advance.

ogromm



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/COPY-from-CSV-ERROR-unterminated-CSV-quoted-field-tp5807700.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: \COPY from CSV ERROR: unterminated CSV quoted field

От
Tom Lane
Дата:
ogromm <alex.schiller1990@web.de> writes:
> I get the error "unterminated CSV quoted field" when I try to copy text with
> "new line \. new line"

> For example:

> CREATE TABLE test (text TEXT);
> \COPY test FROM 'test.csv' WITH DELIMITER ',' CSV HEADER;

> test.csv:
> Text
> "some text
> \.
> more text"

Yeah, psql's \copy command doesn't know anything about CSV mode, and
will take \. as an EOF marker even though it shouldn't.  If you need
to copy data like this I'd suggest using a backend-side COPY.

            regards, tom lane