Karel, Andrew, Fernando:

> On Wed, Mar 17, 2004 at 11:02:38AM -0500, Tom Lane wrote:
> > Karel Zak <zakkr@zf.jcu.cz> writes:
> > >  The formatting function API can be pretty simple:
> > >  text *my_copy_format(text *attrdata, int direction, 
> > >              int nattrs, int attr, oid attrtype, oid relation)

No offense, but isn't this whole thing more appropriate for a client program?   
Like the pg_import and pg_export projects on GBorg?   Has anyone looked at 
those projects?

I can see making a special provision for CSV in COPY, just because it's such a 
universal format.   But I personally don't see that a complex, sophisticated 
import/export formatter belongs on the SQL command line.   Particularly since 
most users will want a GUI to handle it.

And, BTW, I deal with CSV *all the time* for my insurance clients, and I can 
tell you that that format hasn't changed in 20 years.   We can hard-code it 
if it's easier.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco


Thu, 18 Mar 2004 10:32:43 -0800
Josh Berkus <josh@agliodbs.com>
Re: COPY formatting
> 
> And, BTW, I deal with CSV *all the time* for my insurance clients, and I can 
> tell you that that format hasn't changed in 20 years.   We can hard-code it 
> if it's easier.

Well many of my clients consider CSV "Character Separated Value" not 
Comma... Thus I get data like this:

"Hello","Good Bye"
Hello	Good Bye
Hello,Good Bye
"This", "They're"
This	They're
"This"	"Is"	"A"	1


Dealing with all of these different nuances is may or may not be beyond 
the scope of copy but it seems that it could be something that it can 
handle.

Python has a csv module that allows you to assign dialects to any 
specific type of import you are performing.

Sincerely,

Joshua D. Drake



> 


-- 
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com
Mammoth PostgreSQL Replicator. Integrated Replication for PostgreSQL
Thu, 18 Mar 2004 14:28:06 -0800
"Joshua D. Drake" <jd@commandprompt.com>
Re: COPY formatting


Joshua D. Drake wrote:

>>
>> And, BTW, I deal with CSV *all the time* for my insurance clients, 
>> and I can tell you that that format hasn't changed in 20 years.   We 
>> can hard-code it if it's easier.
>
>
> Well many of my clients consider CSV "Character Separated Value" not 
> Comma... Thus I get data like this:
>
> "Hello","Good Bye"
> Hello    Good Bye
> Hello,Good Bye
> "This", "They're"
> This    They're
> "This"    "Is"    "A"    1


*nod* I too have seen these and other variants over the years, including 
some that use single quote instead of double quote as the quote char, 
and \ as the escape char.

My suggested scheme for beefing up COPY was made with all these variants 
in mind.

cheers

andrew


Thu, 18 Mar 2004 17:42:59 -0500
Andrew Dunstan <andrew@dunslane.net>
Re: COPY formatting