X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 754C29DC982 for ; Thu, 2 Mar 2006 10:43:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 80657-05 for ; Thu, 2 Mar 2006 10:43:29 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from uproxy.gmail.com (uproxy.gmail.com [66.249.92.201]) by postgresql.org (Postfix) with ESMTP id A56D19DC967 for ; Thu, 2 Mar 2006 10:43:22 -0400 (AST) Received: by uproxy.gmail.com with SMTP id s2so199824uge for ; Thu, 02 Mar 2006 06:43:25 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=OL/h2zrmb6X1otCDel5Uy35mQ1bvtY7ARyceMAHyKSnS7z98l1GAn+2mMXBDXguptDPlk7n/3IDvVXwgiaHI8OdgvKatX03zcASx3YqGBJDqWGhlHojYmNJC/pnt8WhXNAOGOvVRP09PfJkcrGIXI3Fyjf0hfHZlYITP6ONICyQ= Received: by 10.66.184.3 with SMTP id h3mr395166ugf; Thu, 02 Mar 2006 06:43:25 -0800 (PST) Received: by 10.67.27.10 with HTTP; Thu, 2 Mar 2006 06:43:25 -0800 (PST) Message-ID: Date: Thu, 2 Mar 2006 14:43:25 +0000 From: "Guido Barosio" To: "Aniko.Badzong@swisscom.com" Subject: Re: sql copy does not work Cc: pgsql-admin@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_6499_7528596.1141310605303" References: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.247 required=5 tests=[AWL=0.246, HTML_MESSAGE=0.001] X-Spam-Score: 0.247 X-Spam-Level: X-Archive-Number: 200603/17 X-Sequence-Number: 20774 ------=_Part_6499_7528596.1141310605303 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Not the real solution for your problem, but if you are already using perl, then why not give a try to Pg? http://search.cpan.org/search?query=3DPg&mode=3Dall Regards, G.- On 3/2/06, Aniko.Badzong@swisscom.com wrote: > > Hi > > I have a problem with the copy command. I need to write a Perl script > where I copy the log files into the database. > If I use the copy following syntax in shell script it works, but I need t= o > use it in Perl. > > In shell script look like this and it works. > *su - postgres -c "echo "\""copy test from '/data/20060227.out';"\"" | > psql imsdb"* > > this is how it looks like in Perl: > *system ("su - postgres -c \"echo \"\"\"copy test from > \'/data/log/20060115.out\'\;\"\"\" | psql imsdb\""); * > > I escape always the " but then I get the following error. > copy > sh: | psql imsdb: not found > > If I try the other way around there is always an error that role c does > not exist.... > *system ("su - postgres -c \"psql imsdb -c \"copy mss6n from > '/data/20060227.out'\;\"");* > psql: warning: extra command-line argument "copy" ignored > psql: FATAL: role "-c" does not exist > > If I try to use copy with the -c option I always get an error that role -= c > does not exist. > Anyone has any idea why? > I was searching in the knowledge database and docs for this error but I > can not find anything. > > Many thanks > Aniko > -- /"\ ASCII Ribbon Campaign . \ / - NO HTML/RTF in e-mail . X - NO Word docs in e-mail . / \ ----------------------------------------------------------------- ------=_Part_6499_7528596.1141310605303 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Not the real solution for your problem, but if you are already using perl, = then why not give a try to Pg?

http://= search.cpan.org/search?query=3DPg&mode=3Dall

Regards,
G.-

On 3/2/06, Aniko.Badzong@swiss= com.com <Aniko.Bad= zong@swisscom.com > wrote:

Hi

I have a problem with the copy com= mand. I need to write a Perl script where I copy the log files into the dat= abase.
If I use the copy following synta= x in shell script it works, but I need to use it in Perl.

In shell script look like this and= it works.
su - postgres -c "echo &q= uot;\""copy test from '/data/20060227.out';"\"" | = psql imsdb"

this is how it looks like in Perl:=
system ("su - postgres -c= \"echo \"\"\"copy test from \'/data/log/20060115.out\'= \;\"\"\" | psql imsdb\"");

I escape always the " but the= n I get the following error.
copy
sh:  | psql imsdb: not found=


If I try the other way around ther= e is always an error that role c does not exist....
system ("su - postgres -c= \"psql imsdb -c \"copy mss6n from '/data/20060227.out'\;\"&= quot;);
psql: warning: extra command-line= argument "copy" ignored
psql: FATAL:  role "-c&= quot; does not exist

If I try to use copy with the -c o= ption I always get an error that role -c does not exist.
Anyone has any idea why?
I was searching in the knowledge = database and docs for this error but I can not find anything.


Many thanks
Aniko




--
/"\ &nb= sp; ASCII Ribbon Campaign  .
\ / - NO HTML/RTF in e-mail =  .
X  - NO Word docs in e-mail .
/ \ ----------------= ------------------------------------------------- ------=_Part_6499_7528596.1141310605303--