Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA76341; Wed, 15 Sep 1999 10:01:23 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id KAA19100; Wed, 15 Sep 1999 10:00:02 -0400 (EDT) To: Nuchanach Klinjun cc: =?iso-8859-1?Q?St=E9phane_FILLON?= , pgsql-sql , pgsql-hackers , pgsql-general Subject: Re: [HACKERS] Permission problem with COPY FROM In-reply-to: Your message of Wed, 15 Sep 1999 11:21:48 +0700 (GMT+0700) Date: Wed, 15 Sep 1999 10:00:02 -0400 Message-ID: <19098.937404002@sss.pgh.pa.us> From: Tom Lane Nuchanach Klinjun 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