From: | <Aniko(dot)Badzong(at)swisscom(dot)com> |
---|---|
To: | <jason(dot)minion(at)sigler(dot)com>, <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: sql copy does not work |
Date: | 2006-03-02 14:55:59 |
Message-ID: | E502FDA6FE0C5A4BB4EFA4250A1E049001DBE0B4@sxmbx51.corproot.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Hi Jason
You are a genius:-)) It worked....
I am fighting with it since a week...
Thank you so much.
Regards
Aniko
________________________________
From: Jason Minion [mailto:jason(dot)minion(at)sigler(dot)com]
Sent: Thursday, March 02, 2006 3:49 PM
To: Badzong Aniko, FX-IT-SDY-CIA-MSG; pgsql-admin(at)postgresql(dot)org
Subject: RE: [ADMIN] sql copy does not work
You probably need to add escaped slashes into your perl string to escape
the quotes on the command line. Maybe try:
system ("su - postgres -c \"echo \"\\\"\"copy test from
\'/data/log/20060115.out\'\;\"\\\"\" | psql imsdb\"");
Jason Minion
________________________________
From: pgsql-admin-owner(at)postgresql(dot)org
[mailto:pgsql-admin-owner(at)postgresql(dot)org] On Behalf Of
Aniko(dot)Badzong(at)swisscom(dot)com
Sent: Thursday, March 02, 2006 8:17 AM
To: pgsql-admin(at)postgresql(dot)org
Subject: [ADMIN] sql copy does not work
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
From | Date | Subject | |
---|---|---|---|
Next Message | Olivier Boissard | 2006-03-02 15:53:14 | call an external script from pgsql |
Previous Message | Jason Minion | 2006-03-02 14:48:36 | Re: sql copy does not work |