Re: multiline CSV fields

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: multiline CSV fields
Date: 2004-11-12 04:47:06
Message-ID: 200411120447.iAC4l6m21290@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


Can I see an example of such a failure line?

---------------------------------------------------------------------------

Andrew Dunstan wrote:
>
> 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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-11-12 05:20:58 Re: multiline CSV fields
Previous Message Gevik Babakhani 2004-11-12 04:24:46 Re: newbie compile question. please help

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2004-11-12 05:20:58 Re: multiline CSV fields
Previous Message Patrick B Kelly 2004-11-12 03:35:07 Re: multiline CSV fields