Re: COPY formatting

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: COPY formatting
Дата
Msg-id 405AF532.6080205@dunslane.net
обсуждение исходный текст
Ответ на Re: COPY formatting  (Karel Zak <zakkr@zf.jcu.cz>)
Ответы Re: COPY formatting  (Fernando Nasser <fnasser@redhat.com>)
Re: COPY formatting  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: COPY formatting  ("Thomas Swan" <tswan@idigx.com>)
Список 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Chris Browne
Дата:
Сообщение: Re: COPY formatting
Следующее
От: Francisco Reyes
Дата:
Сообщение: Inherited tables