Fw: problems with copy command
because apache can only run as nobody, in my case.
I thought about it already, I guess the only sulution is stdin.
bye
Paolo
----- Original Message -----
From: "Frank Bax" <fbax@execulink.com>
To: "Paolo Zampieri" <pzampier@it.ip-plus.net>
Sent: Tuesday, May 09, 2000 5:16 PM
Subject: Re: [GENERAL] problems with copy command
Why not just use a different userid (perhaps the userid you used with
psql)
when connecting to the database?
Frank
At 04:53 PM 5/09/00 +0200, you wrote:
hello everybody,
I tried to copy a file into a table from the postgres terminal, and all
worked fine.
But when I tryed the same with the php pg_exec() command the result was:PostgresSQL query failed: ERROR: You must have Postgres superuser
privilege
to do a COPY directly to or from a file. Anyone can COPY to stdout or
from
stdin. Psql's \copy command also works for anyone.
I can't use \copy from php because there is no \copy interface in php,
only
pg_exec(sql command), so the only way is to use stdin!
Someone has ideas about how to pipe the file and than read the pipe from
the
Show quoted text
copy sql command?
hope will interest
bye
Apache might run as 'nobody', but you do not need to connect to pgsql as
'nobody'.
$dbc = pg_connect( "dbname=xxxx user=yyyy" );
'yyyy' does Not need to be 'nobody'.
If 'yyyy' is a user with super-user priviledges, then COPY will work/
I just tested it with the following php code:
$dbc = pg_connect( "dbname=gwacl user=fbax" );
$sql = "copy emptest from '/tmp/empdata.txt'";
pg_FreeResult( pg_exec( $dbc, $sql ) );
pg_close( $dbc );
And it worked just fine (6.5.3).
I got 'permission denied' messages when user did not have super-user
priviledge.
Frank
At 05:24 PM 5/09/00 +0200, you wrote:
Show quoted text
because apache can only run as nobody, in my case.
I thought about it already, I guess the only sulution is stdin.
bye
Paolo
----- Original Message -----
From: "Frank Bax" <fbax@execulink.com>
To: "Paolo Zampieri" <pzampier@it.ip-plus.net>
Sent: Tuesday, May 09, 2000 5:16 PM
Subject: Re: [GENERAL] problems with copy commandWhy not just use a different userid (perhaps the userid you used with
psql)
when connecting to the database?
Frank
At 04:53 PM 5/09/00 +0200, you wrote:
hello everybody,
I tried to copy a file into a table from the postgres terminal, and all
worked fine.
But when I tryed the same with the php pg_exec() command the result was:PostgresSQL query failed: ERROR: You must have Postgres superuser
privilege
to do a COPY directly to or from a file. Anyone can COPY to stdout or
from
stdin. Psql's \copy command also works for anyone.
I can't use \copy from php because there is no \copy interface in php,
only
pg_exec(sql command), so the only way is to use stdin!
Someone has ideas about how to pipe the file and than read the pipe fromthe
copy sql command?
hope will interest
bye