Copy in Postgresql: Absolute Path Interpreted as Relative Path

后端 未结 1 2002
我寻月下人不归
我寻月下人不归 2021-01-14 05:19

I am running this statement in a Django app:

c = connections[\'default\'].cursor()
    query=\"copy (select * from analysis.\\\"{0}\\\") to STDOUT DELIMITER          


        
相关标签:
1条回答
  • 2021-01-14 05:44

    If you want to store data / get data from your local machine and communicate with a Postgres server on a different, remote machine, you cannot simply use COPY.

    Try the meta-command \copy in psql. It's a wrapper for the SQL COPY command and uses local files.

    Your filename should work as is on a Windows machine, but Postgres interprets it as a local filename on the server, which is probably a Unix derivate. And there the filename would have to start with '/'.

    0 讨论(0)
提交回复
热议问题