Re: copy query results to file

Поиск
Список
Период
Сортировка
Искать
От
Thomas Kellerer
Тема
Re: copy query results to file
Дата
Msg-id
jc9nca$20f$1@dough.gmane.org
Ответ на
Список
Дерево обсуждения
copy query results to file "John Payne" <jcpayne@uw.edu>
Re: copy query results to file Pandu Poluan <pandu@poluan.info>
Re: copy query results to file Pandu Poluan <pandu@poluan.info>
Re: copy query results to file Thomas Kellerer <spam_eater@gmx.net>
Re: copy query results to file Michael Wood <esiotrot@gmail.com>
John Payne, 14.12.2011 02:49:
> 2.Use psql to output the data, as in:
>
> a.\o
>
> b.Query here….
>
> c.\o
>
> The psql produces output in an inconvenient format with pipe symbols and headers and underlines.

You can use the options:

\t
\a
\pset fieldsep ,

to get a more "CSV" like output in psql. If you want a tab character as the field delimiter, you can use:

\pset fieldsep '\t'

So the whole thing would be:

\a
\t
\pset fieldsep ,
\o

SELECT ...

\o

Thomas

В списке pgsql-novice по дате отправления
От: Pandu Poluan
Дата:
Сообщение: Re: copy query results to file
От: Michael Wood
Дата:
Сообщение: Re: copy query results to file
FAQ