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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ogromm <alex(dot)schiller1990(at)web(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: \COPY from CSV ERROR: unterminated CSV quoted field
Date: 2014-06-19 21:05:19
Message-ID: 10837.1403211919@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

ogromm <alex(dot)schiller1990(at)web(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Borislav Ivanov 2014-06-19 22:12:39 Re: max_connections reached in postgres 9.3.3
Previous Message Merlin Moncure 2014-06-19 19:56:21 Re: max_connections reached in postgres 9.3.3