Re: Lead and tail quotes with \pset fieldsep

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Lead and tail quotes with \pset fieldsep
Дата
Msg-id 200603200114.k2K1EtF29584@candle.pha.pa.us
обсуждение исходный текст
Ответ на Lead and tail quotes with \pset fieldsep  ("Bath, David" <dave.bath@unix.net>)
Ответы PostgreSQL Handling of Special Characters  ("Christian Paul B. Cosinas" <cpc@cybees.com>)
Список 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. +


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Bath, David"
Дата:
Сообщение: Lead and tail quotes with \pset fieldsep
Следующее
От: "Christian Paul B. Cosinas"
Дата:
Сообщение: PostgreSQL Handling of Special Characters