X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 14F289DCBE0 for ; Sun, 19 Mar 2006 21:14:57 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34355-01 for ; Sun, 19 Mar 2006 21:15:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [70.90.9.53]) by postgresql.org (Postfix) with ESMTP id 617E69DCA19 for ; Sun, 19 Mar 2006 21:14:54 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id k2K1EtF29584; Sun, 19 Mar 2006 20:14:55 -0500 (EST) From: Bruce Momjian Message-Id: <200603200114.k2K1EtF29584@candle.pha.pa.us> Subject: Re: Lead and tail quotes with \pset fieldsep In-Reply-To: <200603201037.07638.dave.bath@unix.net> To: dave.bath@unix.net Date: Sun, 19 Mar 2006 20:14:55 -0500 (EST) CC: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.46 required=5 tests=[AWL=-0.040, RAZOR2_CHECK=0.5] X-Spam-Score: 0.46 X-Spam-Level: X-Archive-Number: 200603/278 X-Sequence-Number: 24624 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. +