psql in the command line

From: <Aniko(dot)Badzong(at)swisscom(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: psql in the command line
Date: 2006-01-25 15:57:22
Message-ID: E502FDA6FE0C5A4BB4EFA4250A1E049001DBE047@sxmbx51.corproot.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi

I need some help regarding psql syntax.
I would like to copy text files into the database from the command line
in a script.
I have found already how can I do it as user postrgres:

test:/opt/pgsql# echo "copy test from '/data/log/bla';" | psql logdb
COPY

But when I try to execute it as root user I get the following error:

[est/data/log] su - postgres -c "echo 'copy test from /data/log/bla;'|
psql logdb"
ERROR: syntax error at or near "/" at character 16
LINE 1: copy test from /data/log/bla;

I have already tried with all kind of double and single quotes but it
does not work.
Anybody has an idea how can I make it run?

Thanks and regards
Aniko

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Alvaro Herrera 2006-01-25 16:05:37 Re: psql in the command line
Previous Message Markus Schaber 2006-01-25 14:54:42 Re: Changing the transaction isolation level within the stored