Re: CSV mode option for pg_dump

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Rod Taylor <pg(at)rbt(dot)ca>, Bill Bartlett <bbartlett(at)softwareanalytics(dot)com>, 'Andrew Dunstan' <andrew(at)dunslane(dot)net>, 'Tom Lane' <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 'PG Hackers' <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CSV mode option for pg_dump
Date: 2006-06-14 15:03:53
Message-ID: 20060614150353.GG4748@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-06-14 15:09:18 Re: CSV mode option for pg_dump
Previous Message Greg Stark 2006-06-14 14:59:36 Re: postgresql and process titles