From: | victor3(dot)lopes(at)voila(dot)fr <victor3(dot)lopes(at)voila(dot)fr> |
---|---|
To: | rmunn <rmunn(at)pobox(dot)com> |
Cc: | pgsql-interfaces <pgsql-interfaces(at)postgresql(dot)org> |
Subject: | Re: TR: Re: TR: interface PERL and return results |
Date: | 2002-10-11 08:34:43 |
Message-ID: | H3T6HV$BD8FFD4099CE8EC76043D9754AD2475F@voila.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
Hello
I have found a solution for my second problem.
Indeed is necessary to use a endcopy command when we use
a copy instruction.
The code should be this :
$res = $db->exec('COPY temp FROM stdin');
open (FIC,'<result.res');
while (<FIC>) {
$db->putline($_);
}
$db->putline("\\.\n");
$db->endcopy;
close(FIC);
The most important is the $db->putline("\\.\n"); with \n before use endcopy. My error had to omit this :-)
Today my copy code works fine :-)
> On Fri, Oct 11, 2002 at 12:29:40AM +0200, victor3(dot)lopes(at)voila(dot)fr wrote:
> > Hello, anyone have a response of my problem ?
>
> Maybe. See below...
> >
> > I have try two methods for charge my result.res in my table.
> >
> > the first method :
> >
> > $res = $db->exec(" COPY temp FROM "full path\result.res ");
> >
> > Unfortunately I did not succeed in using this method, I had always an
> > error ( While placing postgres in debug mode ).
> >
> > DEBUG: StartTransactionCommand
> > DEBUG: query: COPY temp FROM '-- my path -- /result.res'
> > DEBUG: parse tree: { QUERY :command 5 :utility ? :resultRelation 0 :into <>
> > :isPortal false :isBinary false :isTemp false :hasAggs false :hasSubLinks false :rtable
> > <> :jointree <> :rowMarks () :targetList <> :groupClause <> :havingQual <>
> > :distinctClause <> :sortClause <> :limitOffset <> :limitCount <> :setOperations <>
> > :resultRelations ()}
> > DEBUG: ProcessUtility: COPY temp FROM '-- my path -- /result.res'
> > 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 don't understand why this error because the superuser postgres (who had create for
> > launch the server) have the privilege
> > for access and read this file.
>
> In your Perl script, what user and password did you use to connect to
> the database?
Indeed my user is http and is not the superuser. In my host superuser postgresql is user postgres.
>You need to *connect* as the Postgres superuser (which is
> almost always the user named 'postgres').
>
> If you are connected as user postgres then your COPY command should
> work.
>
> --
> Robin Munn
> rmunn(at)pobox(dot)com
Ok, thanks for this information, but i find it's a pity because on all my code i use the user http for to access
tables and I do not see why it would be necessary that I connect differently to use command Copy : - ( for
access directly to my file.
Perhaps a problem of security ?
Thanks
Victor
------------------------------------------
Faites un voeu et puis Voila ! www.voila.fr
From | Date | Subject | |
---|---|---|---|
Next Message | Gerhard Häring | 2002-10-11 08:44:09 | Re: Number of deleted rows in Python module |
Previous Message | rmunn | 2002-10-11 05:56:54 | Re: TR: Re: TR: interface PERL and return results |