I use psql to run a simple set of COPY instructions contained in a file:
psql -d mydb -f 'wbf_queries.data.sql'
where it wbf_queries.data.sqlcontains the lines:
copy <my_query> to '/home/gvkv/mydata' delimiter ',' null '';
...
but I get permission denied:
... ERROR: could not open file ... for writing: Permission denied
I connect to my user account (gvkv), which is also the superuser in PostgreSQL. Obviously psql is running under a different (efficient) user, but I don't know how to change this. Can this be done in psql or do I need some kind of unix-fu?
UPDATE: according to araqnid's answer, here is the relevant information for everyone who comes:
\copy ...
(). , SQL COPY, , psql . , , , SQL.
.