COPY
opens the file using the PostgreSQL server backend, so it requires that the user postgresql runs as have read permission (for COPY FROM
) for the file in question. It also requires the same SQL-level access rights to the table as INSERT
, but I suspect it's file permissions that're getting you here.
Most likely the postgres
or postgres_
(depending on how you installed PostgreSQL) user doesn't have read access to /Users/somepath/tutor.rtf
or some parent directory of that file.
The easiest solution is to use psql
's \copy
command, which reads the file using the client permissions, rather than those of the server, and uses a path relative to the client's current working directory. This command is not available in PgAdmin-III.
Newer PgAdmin-III versions have the Import command in the table context menu. See importing tables from file in the PgAdmin-III docs. This does the equivalent of psql
's \copy
command, reading the file with the access rights of the PgAdmin-III application.
Alternately you can use the server-side COPY
command by making sure every directory from /Users
up somepath
has world-execute rights - meaning users can traverse it, cd into it, etc, but can't list its contents without r
rights too. Then either set the file to group postgres
and make sure it has group read rights, or make it world-readable.