How do I change the effective user of psql?

Posted by gvkv on Stack Overflow See other posts from Stack Overflow or by gvkv
Published on 2010-05-06T10:51:51Z Indexed on 2010/05/06 10:58 UTC
Read the original article Hit count: 277

Filed under:
|
|
|

I'm using psql to run a simple set of COPY statements contained in a file:

psql -d mydb -f 'wbf_queries.data.sql'

where wbf_queries.data.sql contains lines:

copy <my_query> to '/home/gvkv/mydata' delimiter ',' null '';
...

but I get a permission denied error:

... ERROR: could not open file ... for writing: Permission denied

I'm connecting under my user account (gvkv) which is also a superuser in PostgreSQL. Obviously, psql is running under a different (effective) user but I don't know how to change this. Can it be done within psql or do I need some unix-fu?

© Stack Overflow or respective owner

Related posts about psql

Related posts about postgresql