multiline CSV fields - Mailing list pgsql-hackers

From Andrew Dunstan
Subject multiline CSV fields
Date
Msg-id 41929FF6.6090407@dunslane.net
Whole thread Raw
Responses Re: multiline CSV fields  (Patrick B Kelly <pbk@patrickbkelly.org>)
Re: multiline CSV fields  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Darcy Buskermolen has drawn my attention to unfortunate behaviour of 
COPY CSV with fields containing embedded line end chars if the embedded 
sequence isn't the same as those of the file containing the CSV data. In 
that case we error out when reading the data in. This means there are 
cases where we can produce a CSV data file which we can't read in, which 
is not at all pleasant.

Possible approaches to the problem:
. make it a documented limitation
. have a "csv read" mode for backend/commands/copy.c:CopyReadLine() that 
relaxes some of the restrictions on inconsistent line endings
. escape embedded line end chars

The last really isn't an option, because the whole point of CSVs is to 
play with other programs, and my understanding is that those that 
understand multiline fields (e.g. Excel) expect them not to be escaped, 
and do not produce them escaped.

So right now I'm tossing up in my head between the first two options. Or 
maybe there's another solution I haven't thought of.

Thoughts?

cheers

andrew


pgsql-hackers by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: Increasing the length of
Next
From: Neil Conway
Date:
Subject: Re: CREATE or REPLACE function pg_catalog.*