Обсуждение: Can't read input file
Hi,
I am trying to load a table by using the COPY command. I am running the perl script my self and the data is located in the same directory as the perl script. However, I get the following error:
ERROR: COPY command, running in backend with effective uid 501, could not open file '/data/db/db_scripts/counterpoint/contract_IMCODF_SUB_CAT_output' for reading. Errno = Permission denied (13).
This output file is created by the perl script and has the following permissions:
-rw-rw-r-- 1 drajput drajput 8934 Jan 24 09:00 contract_IMCODF_SUB_CAT_output
Any ideas on what is happening. Thanks,
Devinder Rajput
Stores Division Corporate Offices
Chicago, IL
(773) 442-6474
Le Fri, Jan 24, 2003 at 09:13:50AM -0600, Devinder K Rajput a écrit ... > I am trying to load a table by using the COPY command. I am running the > perl script my self and the data is located in the same directory as the > perl script. However, I get the following error: > > ERROR: COPY command, running in backend with effective uid 501, could not > open file > '/data/db/db_scripts/counterpoint/contract_IMCODF_SUB_CAT_output' for > reading. Errno = Permission denied (13). > > This output file is created by the perl script and has the following > permissions: > > -rw-rw-r-- 1 drajput drajput 8934 Jan 24 09:00 > contract_IMCODF_SUB_CAT_output > > Any ideas on what is happening. Thanks, As a newbie myself, my advice probably isn't worth much, but it's almost certainly do do with permissions in the directory. I had this same problem, even though I was running psql as 'desmond', and the files were in /home/desmond/sql. I solved it by placing the txt file into /tmp. Perhaps 'solved' isn't the appropriate word ... 'kludged', anyone ..? :-) -- Desmond Coughlan |'Io non mori, e non rimasi vivo' desmond@zeouane.org http://www.zeouane.org
Вложения
On Fri, 2003-01-24 at 16:45, Desmond Coughlan wrote: > Le Fri, Jan 24, 2003 at 09:13:50AM -0600, Devinder K Rajput a écrit ... > > > I am trying to load a table by using the COPY command. I am running the > > perl script my self and the data is located in the same directory as the > > perl script. However, I get the following error: > > > > ERROR: COPY command, running in backend with effective uid 501, could not > > open file > > '/data/db/db_scripts/counterpoint/contract_IMCODF_SUB_CAT_output' for > > reading. Errno = Permission denied (13). > > > > This output file is created by the perl script and has the following > > permissions: > > > > -rw-rw-r-- 1 drajput drajput 8934 Jan 24 09:00 > > contract_IMCODF_SUB_CAT_output > > > > Any ideas on what is happening. Thanks, Most likely you do not have execute permissions set on one of the directories in the path to that file. All the directories must have execute (search) permission and the file itself must have read permission set for the user under whose id the postmaster is running. And of course, the file must be on the same machine that the postmaster is running on. If it is not possible to satisfy those conditions, you can use \copy in psql instead; the input file is opened by the frontend instead of the backend. -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "If anyone has material possessions and sees his brother in need but has no pity on him, how can the love of God be in him?" I John 3:17
Thank you Desmond and Oliver. The problem is fixed. The directories did not have execute permissions set....That's what i get for using the -R flag with chmod.
kind regards,
Devinder Rajput
Stores Division Corporate Offices
Chicago, IL
(773) 442-6474
"Oliver Elphick" <olly@lfix.co.uk> Sent by: pgsql-novice-owner@postgresql.org 01/24/2003 12:30 PM | To: "Desmond Coughlan" <psql@zeouane.org> cc: pgsql-novice@postgresql.org Subject: Re: [NOVICE] Can't read input file |
On Fri, 2003-01-24 at 16:45, Desmond Coughlan wrote:
> Le Fri, Jan 24, 2003 at 09:13:50AM -0600, Devinder K Rajput a écrit ...
>
> > I am trying to load a table by using the COPY command. I am running the
> > perl script my self and the data is located in the same directory as the
> > perl script. However, I get the following error:
> >
> > ERROR: COPY command, running in backend with effective uid 501, could not
> > open file
> > '/data/db/db_scripts/counterpoint/contract_IMCODF_SUB_CAT_output' for
> > reading. Errno = Permission denied (13).
> >
> > This output file is created by the perl script and has the following
> > permissions:
> >
> > -rw-rw-r-- 1 drajput drajput 8934 Jan 24 09:00
> > contract_IMCODF_SUB_CAT_output
> >
> > Any ideas on what is happening. Thanks,
Most likely you do not have execute permissions set on one of the
directories in the path to that file. All the directories must have
execute (search) permission and the file itself must have read
permission set for the user under whose id the postmaster is running.
And of course, the file must be on the same machine that the postmaster
is running on.
If it is not possible to satisfy those conditions, you can use \copy in
psql instead; the input file is opened by the frontend instead of the
backend.
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"If anyone has material possessions and sees his
brother in need but has no pity on him, how can the
love of God be in him?"
I John 3:17
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/users-lounge/docs/faq.html
Le Fri, Jan 24, 2003 at 03:59:39PM -0600, Devinder K Rajput a écrit ... > Thank you Desmond and Oliver. The problem is fixed. The directories did > not have execute permissions set....That's what i get for using the -R > flag with chmod. At the same time, be careful with the -x bit, if the files are in your $HOME (did you say that they were elsewhere ? I don't recall). I'm not about to give execute permission to anyone in my $HOME, which is why I move the files to /tmp when I'm using copy, and then I delete them as soon as I've incorporated them into the database. It means that they can be read by other users whilst I'm editing them, but as of now, my files are only to practice and learn, and so don't contain confidential information. I was somewhat surprised that I couldn't access the files in $HOME/sql, as I'm using psql as user 'desmond', but then I suppose it's because postmaster and postgres themselves are running under user 'postgres' (if I'm talking bollocks, feel free to correct me). When the time comes to use private data, then I shall follow Oliver's suggestion, and copy via psql ... :-) D. -- Desmond Coughlan |'Io non mori, e non rimasi vivo' desmond@zeouane.org http://www.zeouane.org