Thread: the copy command

the copy command

From
johnf
Date:
Hi,


SUSE 10.2 pgadmin3 1.6.3

When I use a copy command from the pgadmin query screen  as in:

COPY agschgrid (tablename, header1, header2, header3, header4, header5,
coldata1, coldata3, coldata2, coldata4, coldata5, retfield, pkid, prikey,
colcount, lookupfld, regid, lk_filter, "txtBoxID", field1, field2, field3,
field4, field5) FROM '/home/johnf/agschgrid_data.sql'

I always get "file not found".  I don't understand why pgadmin3 can't see my
file?  I can see it from Konqueror and even from the open file of pgadmin3.
So does anyone know why I can run the statement?
--
John Fabiani

Re: the copy command

From
Tom Lane
Date:
johnf <jfabiani@yolo.com> writes:
> When I use a copy command from the pgadmin query screen  as in:

> COPY agschgrid (tablename, header1, header2, header3, header4, header5,
> coldata1, coldata3, coldata2, coldata4, coldata5, retfield, pkid, prikey,
> colcount, lookupfld, regid, lk_filter, "txtBoxID", field1, field2, field3,
> field4, field5) FROM '/home/johnf/agschgrid_data.sql'

> I always get "file not found".

This form of COPY runs on the server, using the server's file access
permissions.  Are you on the same machine that the Postgres server is
on?  Do you have /home/johnf's permissions set so that the Postgres
userid can read it?

> I don't understand why pgadmin3 can't see my file?

pgadmin3 is not involved in executing this command.

There is probably some feature in pgadmin3 by which *it* can open the
file and feed the data across the net to the server, but this command
is not that.

            regards, tom lane

Re: the copy command

From
johnf
Date:
On Monday 10 September 2007 17:31, Tom Lane wrote:
> johnf <jfabiani@yolo.com> writes:
> > When I use a copy command from the pgadmin query screen  as in:
> >
> > COPY agschgrid (tablename, header1, header2, header3, header4, header5,
> > coldata1, coldata3, coldata2, coldata4, coldata5, retfield, pkid, prikey,
> > colcount, lookupfld, regid, lk_filter, "txtBoxID", field1, field2,
> > field3, field4, field5) FROM '/home/johnf/agschgrid_data.sql'
> >
> > I always get "file not found".
>
> This form of COPY runs on the server, using the server's file access
> permissions.  Are you on the same machine that the Postgres server is
> on?  Do you have /home/johnf's permissions set so that the Postgres
> userid can read it?
>
> > I don't understand why pgadmin3 can't see my file?
>
> pgadmin3 is not involved in executing this command.
>
> There is probably some feature in pgadmin3 by which *it* can open the
> file and feed the data across the net to the server, but this command
> is not that.
>
>             regards, tom lane

Thanks to Tom I moved the file to "/tmp" a directory that Postgres has access
too.  Then the copy command worked perfectly from pgadmin3 1.6.3.



--
John Fabiani