pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedLead and tail quotes with \pset fieldsep
2+ messages / 2 participants
[nested] [flat]
* Lead and tail quotes with \pset fieldsep
@ 2006-03-19 23:37 Bath, David <dave.bath@unix.net>
2006-03-20 01:14 ` Re: Lead and tail quotes with \pset fieldsep Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: Bath, David @ 2006-03-19 23:37 UTC (permalink / raw)
To: pgsql-sql
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.
Thanks in advance
--
David T. Bath
dave.bath@unix.net
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Lead and tail quotes with \pset fieldsep
2006-03-19 23:37 Lead and tail quotes with \pset fieldsep Bath, David <dave.bath@unix.net>
@ 2006-03-20 01:14 ` Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Bruce Momjian @ 2006-03-20 01:14 UTC (permalink / raw)
To: dave.bath@unix.net; +Cc: pgsql-sql
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. +
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2006-03-20 01:14 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-03-19 23:37 Lead and tail quotes with \pset fieldsep Bath, David <dave.bath@unix.net>
2006-03-20 01:14 ` Bruce Momjian <pgman@candle.pha.pa.us>
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