Rod Taylor wrote:
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

If you data looks like this:

foo     barbaz  bing

You are o.k. You have three columns, tab delimited.

However if you data looks like this:

foo     bar     baz     bing

You have a problem.

foo is one column
bar and baz are a single column
bing is a single column

How does excel know that bar baz is a single column? It doesn't because you told it to delimit on tabs and thus you have four columns as far as Excel is concerned.

An alternative although I don't know what kind of headaches it would cause is to have a text delimiter as well as a field delimter, e.g;

"foo" "bar       baz"       "bing"

Sincerely,

Joshua D. Drake





-----Original Message-----
From: Joshua D. Drake [mailto:[EMAIL PROTECTED] 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/



---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly



--

            === 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/



---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to