1

I want to send data from my local postgresql to a remote server in csv form.. something similar to copy (select * from table) to /home/ubuntu/a.csv with csv But in place of local direcory, I want to take this csv dump in other server

Deepak Banka
  • 591
  • 1
  • 6
  • 24
  • Is not supported by `COPY` but there is some workarounds. Describe better you scenario. Are you using psql? Take a look here: http://dba.stackexchange.com/questions/36235/export-postgres-table-on-remote-server-to-csv-file-on-local-machine – Tom-db Sep 29 '15 at 13:02

2 Answers2

0

Use the psql client's \copy feature; this does exactly what you want.

Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
0

As far as I know copy command reads/writes from local path/location. To generate the output file on the remote server, you need to use a script(bash/python) to execute copy command on remote server.

abhish_gl
  • 363
  • 1
  • 10
  • `copy` always writes the file on the **server**. Don't confuse it with psql's `\copy` which writes the file to the client. –  Sep 30 '15 at 06:52