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

From Martijn van Oosterhout
Subject Re: CSV mode option for pg_dump
Date
Msg-id 20060614150353.GG4748@svana.org
Whole thread Raw
In response to Re: CSV mode option for pg_dump  ("Joshua D. Drake" <jd@commandprompt.com>)
List pgsql-hackers
On Tue, Jun 13, 2006 at 09:14:48AM -0700, Joshua D. Drake wrote:
> >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.

I'm not exactly sure what you're getting at here:

postgres=# create temp table x (a text, b text, c text);
CREATE TABLE
postgres=# insert into x values ('"blah"', 'hello       world', 'hmmm
postgres'# ');
INSERT 0 1
postgres=# \copy x to stdout csv
"""blah""",hello        world,"hmmm
"

> 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;

Postgresql already delimits CSV fields as required, so I'm not sure what
you're asking here...

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: postgresql and process titles
Next
From: Martijn van Oosterhout
Date:
Subject: Re: CSV mode option for pg_dump