Re: [HACKERS] Permission problem with COPY FROM

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nuchanach Klinjun <nuchk(at)inet(dot)co(dot)th>
Cc: Stéphane FILLON <fillons(at)offratel(dot)nc>, pgsql-sql <pgsql-sql(at)postgreSQL(dot)org>, pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org>, pgsql-general <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] Permission problem with COPY FROM
Date: 1999-09-15 14:00:02
Message-ID: 19098.937404002@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql

Nuchanach Klinjun <nuchk(at)inet(dot)co(dot)th> writes:
> I've faced that problem too, then I use '\copy' instread
> of 'copy' because 'copy' command will asked for super user previlege.
> example
> ^^^^^^ -> \copy '/your location/your filename' to tablename;

It's not that; the error message Stephane quotes is after the
Postgres superuser-privilege check:

>> "ERROR: COPY command, running in backend with effective uid 501
>> (that's Postgres), could not open file '/usr/local/.../cltclr001' for
>> reading. Error: Permission not allowed (13)."

This is a result of the Unix kernel denying read access to the file.
It's got to be a matter of not having read rights on the file or not
having lookup (x) rights on one of the directories above it.

psql's \copy is often a better choice than the regular SQL COPY command,
though. It reads or writes the file with the privileges of the user
running psql, rather than those of the Postgres server, which is usually
a Good Thing. Also, if you are contacting a server on a different
machine, \copy works with files in the local filesystem, not the
server's filesystem.

regards, tom lane

Browse pgsql-general by date

  From Date Subject
Next Message Albert REINER 1999-09-15 16:14:10 Re: [SQL] Permission problem with COPY FROM
Previous Message Tom Lane 1999-09-15 13:46:35 Re: [HACKERS] BUG with UNIQUE clause

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-09-15 14:02:07 Re: [HACKERS] Status report: long-query-string changes
Previous Message Tom Lane 1999-09-15 13:46:35 Re: [HACKERS] BUG with UNIQUE clause

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-09-15 14:26:37 Re: [SQL] SELECT DISTINCT and ORDER BY
Previous Message Tom Lane 1999-09-15 13:53:02 Re: [SQL] to do's?