Thread: problems with copy

problems with copy

From
"Steff"
Date:
Hello

I'm starting using PostgreSQL and want to import datas from my old database.
I've made ASCII delimited files and want to use the copy instruction.

Having the server started, I do the following :

> psql mydb
>copy table from 'myfile' using delimiters ';' ;

I'vegot an error saying that the backend server can't read myfile. I've
check rights on this file and every user can read this file.
I've created the table and checked that it exists.
    Can someone help Me ??

Thanks in advance

Stephane



Re: problems with copy

From
Doug McNaught
Date:
"Steff" <stephane.eveillard@netcourrier.com> writes:

> I'm starting using PostgreSQL and want to import datas from my old database.
> I've made ASCII delimited files and want to use the copy instruction.
>
> Having the server started, I do the following :
>
> > psql mydb
> >copy table from 'myfile' using delimiters ';' ;
>
> I'vegot an error saying that the backend server can't read myfile. I've
> check rights on this file and every user can read this file.
> I've created the table and checked that it exists.

Some possibilities:

* The backend can't find the file because you're using a relative
  pathname.  Try using an absolute pathname (one that starts with
  '/').  The backend has its own working directory, which is generally
  different from that of the 'psql' process.
* The 'postgres' user doesn't have read/search permission on one of
  the directories leading to the file (eg, if /home/doug is not
  world-searchable, no other user can read /home/doug/myfile, no
  matter what permissions are on 'myfile' itself).

-Doug