Forums

accessing server filesystem from Postgres database

Postgres (postgresql) has a COPY command that can be used to read from or write to a file on the filesystem. When I try to use the command from within the Postgres console, I get an error "could not open file "/path/to/filename.txt" for writing: Permission denied.'

I saw in another forum post that I could use psql with the '\copy' command from within the Bash console, but I have postgres functions that use the COPY TO command to output log files during runtime.

Is there any way that the Postgres database server on pythonanywhere can utilize the COPY command that is built into and included with Postgres to interact with the filesystem?

Postgres has no access to your file system so it won't work.