pg.ddx.io pgsql-general@postgresql.org mailing list archivehelp / color / mirror / Atom feed
COPY error when \. char 2+ messages / 2 participants [nested] [flat]
* COPY error when \. char @ 2018-03-20 11:32 Nicolas Paris <niparisco@gmail.com> 2018-03-20 13:29 ` Re: COPY error when \. char Adrian Klaver <adrian.klaver@aklaver.com> 0 siblings, 1 reply; 2+ messages in thread From: Nicolas Paris @ 2018-03-20 11:32 UTC (permalink / raw) To: pgsql-general@lists.postgresql.org Hello I get an error when loading this kind of csv: > test.csv: "hello ""world"" " "\." "this works " "this \. does not" > table: create table test (field text); > sql: \copy test (field) from 'test.csv' CSV quote '"' ESCAPE '"'; ERROR: unterminated CSV quoted field CONTEXTE : COPY test, line 7: ""this " Apparently, having the \. string in a single line make it break. Is this normal ? Thanks ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: COPY error when \. char 2018-03-20 11:32 COPY error when \. char Nicolas Paris <niparisco@gmail.com> @ 2018-03-20 13:29 ` Adrian Klaver <adrian.klaver@aklaver.com> 0 siblings, 0 replies; 2+ messages in thread From: Adrian Klaver @ 2018-03-20 13:29 UTC (permalink / raw) To: Nicolas Paris <niparisco@gmail.com>; pgsql-general@lists.postgresql.org On 03/20/2018 04:32 AM, Nicolas Paris wrote: > Hello > > I get an error when loading this kind of csv: > >> test.csv: > "hello ""world""" > "\." > "this > works > " > "this > \. > does > not" > >> table: > create table test (field text); > >> sql: > \copy test (field) from 'test.csv' CSV quote '"' ESCAPE '"'; > ERROR: unterminated CSV quoted field > CONTEXTE : COPY test, line 7: ""this > " > > Apparently, having the \. string in a single line make it break. > Is this normal ? https://www.postgresql.org/docs/10/static/sql-copy.html "Because backslash is not a special character in the CSV format, \., the end-of-data marker, could also appear as a data value. To avoid any misinterpretation, a \. data value appearing as a lone entry on a line is automatically quoted on output, and on input, if quoted, is not interpreted as the end-of-data marker. If you are loading a file created by another application that has a single unquoted column and might have a value of \., you might need to quote that value in the input file." > > Thanks > > -- Adrian Klaver adrian.klaver@aklaver.com ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-03-20 13:29 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-03-20 11:32 COPY error when \. char Nicolas Paris <niparisco@gmail.com> 2018-03-20 13:29 ` Adrian Klaver <adrian.klaver@aklaver.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox