\COPY from CSV ERROR: unterminated CSV quoted field

Started by ogrommalmost 12 years ago2 messagesgeneral
Jump to latest
#1ogromm
alex.schiller1990@web.de

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.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: ogromm (#1)
Re: \COPY from CSV ERROR: unterminated CSV quoted field

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

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general