pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Guido Barosio <gbarosio@gmail.com>
To: Aniko.Badzong@swisscom.com <Aniko.Badzong@swisscom.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: sql copy does not work
Date: Thu, 2 Mar 2006 14:43:25 +0000
Message-ID: <f7f6b4c70603020643l7e954680vf81ee76ae8a81602@mail.gmail.com> (raw)
In-Reply-To: <E502FDA6FE0C5A4BB4EFA4250A1E049001DBE0B2@sxmbx51.corproot.net>
References: <E502FDA6FE0C5A4BB4EFA4250A1E049001DBE0B2@sxmbx51.corproot.net>

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=Pg&mode=all

Regards,
G.-

On 3/2/06, Aniko.Badzong@swisscom.com <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 to
> 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 .
/ \ -----------------------------------------------------------------

view thread (4+ messages)  latest in thread

Message-ID: <f7f6b4c70603020643l7e954680vf81ee76ae8a81602@mail.gmail.com>
Permalink:  ../f7f6b4c70603020643l7e954680vf81ee76ae8a81602@mail.gmail.com/
Also on:    postgresql.org/message-id/f7f6b4c70603020643l7e954680vf81ee76ae8a81602@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: gbarosio@gmail.com, Aniko.Badzong@swisscom.com
  Subject: Re: sql copy does not work
  In-Reply-To: <f7f6b4c70603020643l7e954680vf81ee76ae8a81602@mail.gmail.com>
  References: <E502FDA6FE0C5A4BB4EFA4250A1E049001DBE0B2@sxmbx51.corproot.net> <f7f6b4c70603020643l7e954680vf81ee76ae8a81602@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox