postgresql \copy the remote file into local file

45 views
Skip to first unread message

karthik reddy singireddy

unread,
Dec 1, 2016, 11:06:53 AM12/1/16
to nodejs
Hi 
I have found two ways for export postgresql to csv using below two commands in windows command terminal:
1) it is to export into remote machine where postgres is running
copy (SELECT firstname, lastname FROM emps ORDER BY lastname, firstname) TO 'E:/file_test' CSV HEADER 
2) it is to export into local machine from where we try to connect remote machine
\copy (SELECT firstname, lastname FROM emps ORDER BY lastname, firstname) TO 'E:/file9' CSV HEADER

In node js second command (i.e \copy) is not working using node 'pg' npm package.

Is there any way to use \copy in node js ?

please let me know as soon as possible.......
Reply all
Reply to author
Forward
0 new messages