Re: Copy query results to a file

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема Re: Copy query results to a file
Дата
Msg-id 1092082157.13140.342.camel@linda
обсуждение исходный текст
Ответ на Copy query results to a file  (Eduardo Vázquez Rodríguez<evazquez@insys-corp.com.mx>)
Список pgsql-novice
On Mon, 2004-08-09 at 20:00, Eduardo Vázquez Rodríguez wrote:
> My purpose is to copy the results of a query to a file, how I do that?
>
> Thanks in advenced

$ psql -d mydb
mydb=# \o /path/to/file
mydb=# select ...;
mydb=# \o


In that case /path/to/file must be writable by the backend.

Alternatively,

$ psql -d mydb -c "select ..." > /path/to/file

If you are using Windows, the syntax of the latter method may be
different.

--
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
     "Be still before the LORD and wait patiently for him;
      do not fret when men succeed in their ways, when they
      carry out their wicked schemes."
                            Psalms 37:7


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

Предыдущее
От: Eduardo Vázquez Rodríguez
Дата:
Сообщение: Copy query results to a file
Следующее
От: Thiemo Kellner
Дата:
Сообщение: Re: [GENERAL] Error >>syntax error<< at >>$1<< at character 53