From: | Karel Zak <zakkr(at)zf(dot)jcu(dot)cz> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | Postgresql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: COPY formatting |
Date: | 2004-03-19 09:39:00 |
Message-ID: | 20040319093900.GA16735@zf.jcu.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 of
global static values" before add something to this code. (My privite
opinion of course).
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.
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.
Karel
--
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
http://home.zf.jcu.cz/~zakkr/
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2004-03-19 10:22:04 | Question on restoring and compiled plans |
Previous Message | Richard Huxton | 2004-03-19 07:47:14 | Re: Authentication drop-down? |