Re: COPY formatting

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Postgresql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: COPY formatting
Date: 2004-03-19 13:27:14
Message-ID: 405AF532.6080205@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Karel Zak wrote:

> The problem with CSV is that it will correctly work with new protocol
> only. Because old versions of clients are newline sensitive. And CSV
> can contains newline in by quotation marks defined attributes:
>
> "John", "Smith", "The White House
> 1600 Pennsylvania Avenue NW
> Washington, DC 20500", "male", "open source software office"
>
> It is one record.
>

(Long Live President Smith!)

I have never seen such a beast, and if I had been asked off the cuff
would have said that it was probably illegal, except that I know of no
standard actually defining the format. Perhaps others (Joshua Drake or
Josh Berkus?) have wider experience. I think in any case we should
ignore those for now and handle the straightforward case.

I *have* seen monstrosities like fields that do not begin with the quote
character but then break into a quote, e.g.:

1,2,a,123"abc""def",6,7,8

>
> It's difficult to say it :-), but your DELIMITER idea is better than my
> suggested API. Andrew, go ahead. I thought about some data streaming,
> but COPY is probably bad place for it.
>
>
>

Just to be clear, I have no current plans for doing this. I have about 3
pg related things I am working on, in addition to doing paid work so I
can eat! If I do it it will not be for quite a while.

There are some wrinkles, though, concerning the interaction of CSV's
notion of escaping and COPY's notion of escaping. If someone want to
undertake this I can flesh those out in a further email.

Someone was asking the other day about a newbie or student project -
this might be a good one (impact relatively isolated, very easy to test)
although possibly not as sexy as some might like.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Larry Rosenman 2004-03-19 13:39:18 Re: [HACKERS] UnixWare/CVS Tip/initdb.c needs to use threads
Previous Message Bruce Momjian 2004-03-19 13:01:53 Re: UnixWare/CVS Tip/initdb.c needs to use threads flags...