Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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: copytest.sql
Description: text/x-sql (979 bytes)
Attachment: copy-diff
Description: text/plain (12.3 KB)

Responses

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group