Search Postgresql Archives

Re: export a select result in a file ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2005-10-04 at 07:00, ctobini wrote:
> Hello,
> 
> I don't find in the PostgreSQL doc how to export a select result in a
> text file.

If you want to get the data without being IN psql (like in an automated
script) you can use the -tc switches ("t"uples only, run this
"c"ommand):

psql dbname -tc "select yabba from dabba where doo=1" > myfile.dat

If you're in psql, use \o for output.  \i does the same thing for input
from a file.

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux