From: Bruce Momjian <pgman@candle.pha.pa.us>
To: dave.bath@unix.net
Cc: pgsql-sql@postgresql.org
Subject: Re: Lead and tail quotes with \pset fieldsep
Date: Sun, 19 Mar 2006 20:14:55 -0500 (EST)
Message-ID: <200603200114.k2K1EtF29584@candle.pha.pa.us> (raw)
In-Reply-To: <200603201037.07638.dave.bath@unix.net>
Bath, David wrote:
> Folks
>
> If I want psql to generate CSV files fully-double-quoted I can
> use pset as follows
> psql> \pset fieldsep ","
> However this does not put a quote before the first field and
> after the last, so each row comes out as
> 1234","blahblah","sdfgsg","foo","bar
>
> Is there a way to use psql to give rows like
> 1234","blahblah","sdfgsg","foo","bar
> or is there another tool I should use.
>
> COPY doesn't deal with views and restrictions well so it is
> not an option.
Just do:
CREATE TEMP TABLE x AS SELECT * FROM view;
COPY ... x
Sorry that is the only way to dump CVS properly.
--
Bruce Momjian http://candle.pha.pa.us
SRA OSS, Inc. http://www.sraoss.com
+ If your life is a hard drive, Christ can be your backup. +
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: pgman@candle.pha.pa.us, dave.bath@unix.net
Subject: Re: Lead and tail quotes with \pset fieldsep
In-Reply-To: <200603200114.k2K1EtF29584@candle.pha.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox