Re: CSV mode option for pg_dump

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: CSV mode option for pg_dump
Date: 2006-06-14 15:09:18
Message-ID: 20060614150918.GH4748@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 14, 2006 at 10:55:04AM -0400, Bruce Momjian wrote:
> > Once again: give me a plausible use-case for pulling this data out of a
> > pg_dump output file. You'd need data-massaging code anyway just to
> > extract the data, so why not expect that code to convert to CSV or
> > whatever other format you might want? If you can think of use-cases like
> > this, why do you think the destination format is necessarily CSV and not
> > something else? If it is something else, adding a CSV option to pg_dump
> > makes it *harder* not easier to write that massaging code, because now
> > it's got to cope with N dump formats not one.
>
> I don't have to think of a use case. I trusted the people who said we
> needed CSV, so I trust them again if they say doing pg_dump with CSV
> would be a good idea.

I think the point is that it's hard to imagine a use case for CSV
support in pg_dump that isn't already better served by using psql. If
you add it to pg_dump, people have to write special code to extract it
anyway, so why can't they handle the tab delimited themselves.

OTOH, if you use psql you get straightforward CSV wit no garbage at
the beginning or end, just straight, raw, CSV.

$ psql postgres -c '\copy pg_namespace to stdout csv'
pg_toast,10,
pg_temp_1,10,
pg_catalog,10,"{kleptog=UC/kleptog,=U/kleptog}"
public,10,"{kleptog=UC/kleptog,=UC/kleptog}"
information_schema,10,"{kleptog=UC/kleptog,=U/kleptog}"

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 Greg Stark 2006-06-14 15:09:35 Re: CSV mode option for pg_dump
Previous Message Martijn van Oosterhout 2006-06-14 15:03:53 Re: CSV mode option for pg_dump