dbTalk Databases Forums  

Re: Copy query results to a file

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss Re: Copy query results to a file in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Oliver Elphick
 
Posts: n/a

Default Re: Copy query results to a file - 08-09-2004 , 03:09 PM






On Mon, 2004-08-09 at 20:00, Eduardo Vázquez Rodríguez wrote:
Quote:
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 (AT) lfix (DOT) 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


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.