Re: CSV mode option for pg_dump - Mailing list pgsql-hackers

From Bill Bartlett
Subject Re: CSV mode option for pg_dump
Date
Msg-id 0fd501c68f09$9bc75f50$1e00a8c0@bartletthome.com
Whole thread Raw
In response to Re: CSV mode option for pg_dump  (Rod Taylor <pg@rbt.ca>)
List pgsql-hackers
> From: Rod Taylor [mailto:pg@rbt.ca] 
> Sent: Tuesday, June 13, 2006 11:31 AM
> 
> 
> On Mon, 2006-06-12 at 16:28 -0400, Bill Bartlett wrote:
> > Can't -- the main production database is over at a CoLo site with 
> > access only available via SSH, and tightly-restricted SSH at that. 
> > Generally one of the developers will SSH over to the 
> server, pull out 
> > whatever data is needed into a text file via psql or 
> pg_dump, scp the 
> > file(s) back here and send them to the user.
> 
> I don't get it. If you can use psql then you already have csv support.
> 
> psql -c 'COPY pg_class TO STDOUT WITH CSV' postgres > pg_class.csv

Ah - RTF-UPDATED-M on my part.  Most of my systems are still in PG 7.4.x
databases so I tend to stick with the 7.x docs, and I didn't notice the
"WITH CSV" option added in 8.0.  That, plus temp tables, will be very
useful.

However, I also agree with the need for a new "pg_query / pg_export"
program. A program geared solely towards exporting the results of a
query would allow many of the options that are needed for the
ever-growing variety of output formats (XML, CSV, HTML, XHTML, etc.) and
details for each format without needing to clutter up pg_dump with
things that really having nothing to do with backing up and restoring
data.  It could also allow a large range of options related to getting
data out (where, order by), many of which have also been discussed for
pg_dump recently.

- Bill

> 
> > > -----Original Message-----
> > > From: Joshua D. Drake [mailto:jd@commandprompt.com]
> > > Sent: Monday, June 12, 2006 4:15 PM
> > > To: Bill Bartlett
> > > Cc: 'Andrew Dunstan'; 'Tom Lane'; 'PG Hackers'
> > > Subject: Re: [HACKERS] CSV mode option for pg_dump
> > > 
> > > 
> > > Bill Bartlett wrote:
> > > > Here's me speaking up -- I'd definitely use it!   As a 
> > > quick way to pull
> > > > data into Excel to do basic reports or analysis, a CSV
> > > format would be
> > > > great.
> > > 
> > > Why not just use ODBC?
> > > 
> > > Joshua D. Drake
> > > --
> > > 
> > >              === The PostgreSQL Company: Command Prompt, Inc. ===
> > >        Sales/Support: +1.503.667.4564 || 24x7/Emergency:
> > > +1.800.492.2240
> > >        Providing the most comprehensive  PostgreSQL solutions
> > > since 1997
> > >                       http://www.commandprompt.com/
> > > 
> > > 
> -- 
> 



pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: CSV mode option for pg_dump
Next
From: Steve Atkins
Date:
Subject: Re: CSV mode option for pg_dump