Search Postgresql Archives

Re: Data dumps to files - best methods?

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

 



Hi,

Am 23.07.2010 um 10:32 schrieb Machiel Richards:

       As I am fairly new to postgresql I am trying to find some more info regarding options to dump specific data to files. 

     However, even though I can get the sql query,etc... how will I use this to dump the data into the relevant files?

You can use the "\copy" command in psql to export the result of query into a file. For example:

> psql -c "\\copy (select * from atable) to 'myfile.csv' with delimiter as ',' csv header" adb

will copy all rows from "atable" in "adb" to "myfile.csv" in csv format.


Ralf

[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