Re: sql copy does not work

Поиск
Список
Период
Сортировка
От Jason Minion
Тема Re: sql copy does not work
Дата
Msg-id 261CF9EEB14F5442894AB6DDA93AA6F407592B@mail.siglercompanies.com
обсуждение исходный текст
Ответ на sql copy does not work  (<Aniko.Badzong@swisscom.com>)
Список pgsql-admin
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@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Aniko.Badzong@swisscom.com
Sent: Thursday, March 02, 2006 8:17 AM
To: pgsql-admin@postgresql.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

В списке pgsql-admin по дате отправления:

Предыдущее
От: "Guido Barosio"
Дата:
Сообщение: Re: sql copy does not work
Следующее
От:
Дата:
Сообщение: Re: sql copy does not work