CSV multiline final fix

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: CSV multiline final fix
Date: 2005-02-21 00:59:25
Message-ID: 4219326D.5060801@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Well, in response to the huge number (0) of comments on my POC patch to
fix this, I prepared the attached patch, which improves on my previous
effort a bit (there was one obscure failure case which is now handled).

Basically, all the required logic is in a new function CopyReadLineCSV()
which is almost but not quite like CopyReadLine(). The new function
keeps just enough state to know if a line ending sequence (CR, CRLF, or
LF) is part of a quoted field or not. This gets rid of the need for
special casing embedded line endings on input elsewhere, so that is
removed, as is the warning about them on output that we added back in
december (as we then thought just before release). Lastly, the docs are
also patched.

Also attached is my tiny test file - maybe we need to cover this in
regression tests?

cheers

andrew

Attachment Content-Type Size
copy-diff text/plain 12.3 KB
copytest.sql text/x-sql 979 bytes

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2005-02-21 02:15:31 Re: pg_ctl reference page
Previous Message Peter Eisentraut 2005-02-20 22:24:06 Re: Change < to -f in examples with input files