title: Copy in Postgresql: Absolute Path Interpreted as Relative Path
body: <p>I am running this statement in a Django app:</p>
  
  <pre><code>c = connections['default'].cursor()
      query="copy (select * from analysis.\"{0}\") to STDOUT DELIMITER ',' CSV HEADER;".format(view_name)
              with open(csvFile,'w') as f:
                  c.copy_expert(query,f)
              f.close()
  </code></pre>
  
  <p>It does not create the correct csv file. Some of the values appear to be in the wrong columns. I am trying to test the SQL statement by running it in POSTGRESQL:</p>
  
  <pre><code> copy (select * from analysis."S03_2005_activity_140807_153431_with_geom") to 'C:/djangoProjects/web_output/csvfiles/S03_2005_activity_140807_153431_with_geom.csv' DELIMITER ',' CSV HEADER;
  </code></pre>
  
  <p>It gives me: "ERROR:  relative path not allowed for COPY to file". I have looked into the issue and it appears to typically be one of two issues: 1. confusing '\' and '/'. My slashes should be correct. 2. The server being on a different computer. I thought this may be my issue as the database is located on an external computer, but I have the connection in my Postgresql. It also runs from Django so I'm not sure why it isn't working from PG Admin.</p>