Re: COPY formatting

Поиск
Список
Период
Сортировка
От Karel Zak
Тема Re: COPY formatting
Дата
Msg-id 20040319093900.GA16735@zf.jcu.cz
обсуждение исходный текст
Ответ на Re: COPY formatting  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: COPY formatting  (Andrew Dunstan <andrew@dunslane.net>)
Re: COPY formatting  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Thu, Mar 18, 2004 at 09:36:17AM -0500, Andrew Dunstan wrote:
> Lee Kindness wrote:
> 
> >To be honest this idea strikes me as overkill - over
> >engineering. While there is a clear need for proper CSV import
> >(i.e. just setting DELIMITER to ',' doesn't work due to ','s in
> >strings) I cannot see how this would prove useful, or who would use
> >it?
> >
> > 
> >
> I agree. My modest proposal for handling CSVs would be to extend the 
> DELIMITER parameter to allow up to 3 characters - separator, quote and 
> escape. Escape would default to the quote char and the quote char would 
> default to unspecified. This would involve no grammar changes and fairly 
> isolated and small code changes, I believe. In the most common CSV cases 
> you would just use $$,"$$ or $$,'$$. :-)
I look at backend COPY code and  it will better clean up this "party ofglobal static  values" before add  something to
this code. (My priviteopinion of course).
 
The problem with  CSV is that it will correctly  work with new protocolonly. Because old  versions of  clients are
newline sensitive. And CSVcan contains newline in by quotation marks defined attributes:
 
"John", "Smith", "The White House1600 Pennsylvania Avenue NWWashington, DC 20500", "male", "open source software
office"Itis one record.  It's difficult to say it :-), but your DELIMITER idea is better than mysuggested API. Andrew,
goahead. I thought about  some data streaming,but COPY is probably bad place for it.
 
   Karel

-- Karel Zak  <zakkr@zf.jcu.cz>http://home.zf.jcu.cz/~zakkr/


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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Authentication drop-down?
Следующее
От: Richard Huxton
Дата:
Сообщение: Question on restoring and compiled plans