Re: psql in the command line

From: "Owen Jacobson" <ojacobson(at)osl(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: psql in the command line
Date: 2006-01-25 17:43:49
Message-ID: 144D12D7DD4EC04F99241498BB4EEDCC1DE489@nelson.osl.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Alvaro Herrera wrote:

> Aniko(dot)Badzong(at)swisscom(dot)com wrote:
>
> > 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;
>
> This is clearly not the same line. The quotes are not in the same
> position as in the line above.
>
> su - postgres -c "psql logdb -c 'copy test from \'data/log/bla\''"

Or, preferably:

$ echo "copy test from '/data/log/bla';" | sudo -u postgres psql logdb

HTH,
Owen

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Fuhr 2006-01-25 17:53:38 Re: filtering after join
Previous Message andrew 2006-01-25 17:27:33 filtering after join