FW: sql copy does not work
От | |
---|---|
Тема | FW: sql copy does not work |
Дата | |
Msg-id | E502FDA6FE0C5A4BB4EFA4250A1E049001DBE0B3@sxmbx51.corproot.net обсуждение исходный текст |
Список | pgsql-sql |
<br /><p><font face="Courier New" size="2">Hi </font><p><font face="Courier New" size="2">I have a problem with the copycommand. I need to write a Perl script where I copy the log files into the database.</font><br /><font face="CourierNew" size="2">If I use the copy following syntax in shell script it works, but I need to use it in Perl.</font><p><fontface="Courier New" size="2">In shell script look like this and it works.</font><br /><b><font face="CourierNew" size="2">su - postgres -c "echo "\""copy test from '/data/20060227.out';"\"" | psql imsdb"</font></b><p><fontface="Courier New" size="2">this is how it looks like in Perl:</font><br /><b><font face="CourierNew" size="2">system ("su - postgres -c \"echo \"\"\"copy test from \'/data/log/20060115.out\'\;\"\"\" | psqlimsdb\""); </font></b><p><font face="Courier New" size="2">I escape always the " but then I get the following error.</font><br/><font face="Courier New" size="2">copy</font><br /><font face="Courier New" size="2">sh: | psql imsdb:not found</font><br /><p><font face="Courier New" size="2">If I try the other way around there is always an error thatrole c does not exist....</font><br /><b><font face="Courier New" size="2">system ("su - postgres -c \"psql imsdb -c\"copy mss6n from '/data/20060227.out'\;\"");</font></b><br /><font face="Courier New" size="2">psql: warning: extra command-lineargument "copy" ignored</font><br /><font face="Courier New" size="2">psql: FATAL: role "-c" does not exist</font><p><fontface="Courier New" size="2">If I try to use copy with the -c option I always get an error that role -cdoes not exist.</font><br /><font face="Courier New" size="2">Anyone has any idea why?</font><br /><font face="CourierNew" size="2">I was searching in the knowledge database and docs for this error but I can not find anything.</font><br/><p><font face="Courier New" size="2">Many thanks</font><br /><font face="Courier New" size="2">Aniko</font>
В списке pgsql-sql по дате отправления: