Thread: copy command

copy command

From
Jim Bryan
Date:
Hi! - Fedora Core 5, cannot copy text file into a
table called datetime, yet the permissions seem OK:

copy datetime from '/home/jb/Desktop/DateTimeData.txt'
with csv;

ERROR:  could not open file
"/home/jb/Desktop/DateTimeData.txt" for reading:
Permission denied

-rw-rw-r-- 1 jb   jb         83 Aug 25 14:30
DateTimeData.txt

Linux log-in is user: jb, su to root for /sbin/service
postgresql start (was installed using default user:
postgres and the servers still use postgres).
This might be more of a linux question, but for some
reason the back-end Postgresql server can't get into
the needed text file -?  Ideas appreciated.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Re: copy command

From
Gregory Stark
Date:
Jim Bryan <gooddayarizona@yahoo.com> writes:

> "/home/jb/Desktop/DateTimeData.txt" for reading:
> Permission denied
>
> -rw-rw-r-- 1 jb   jb         83 Aug 25 14:30
> DateTimeData.txt

I suspect it doesn't have "x" permission on some parent directory, what does

ls -ld /home /hoome/jb /home/jb/Desktop

print?


--
greg

Re: copy command

From
Tom Lane
Date:
Gregory Stark <gsstark@mit.edu> writes:
> Jim Bryan <gooddayarizona@yahoo.com> writes:
>> "/home/jb/Desktop/DateTimeData.txt" for reading:
>> Permission denied
>>
>> -rw-rw-r-- 1 jb   jb         83 Aug 25 14:30
>> DateTimeData.txt

> I suspect it doesn't have "x" permission on some parent directory,

Yeah, user home directories are not normally world-readable in Fedora.
Even if you've made yours readable, the default SELinux policy in FC5
prevents daemons such as the PG postmaster from accessing random parts
of the filesystem.

Consider using psql's \copy instead.

            regards, tom lane