X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 721A39DC829 for ; Wed, 25 Jan 2006 13:43:38 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 31659-02 for ; Wed, 25 Jan 2006 13:43:37 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 81A889DC871 for ; Wed, 25 Jan 2006 13:43:36 -0400 (AST) Received: from nelson.osl.com (216-21-133-120.ip.van.radiant.net [216.21.133.120]) by svr4.postgresql.org (Postfix) with ESMTP id B985E5AF84E for ; Wed, 25 Jan 2006 17:43:36 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: psql in the command line Date: Wed, 25 Jan 2006 09:43:49 -0800 Message-ID: <144D12D7DD4EC04F99241498BB4EEDCC1DE489@nelson.osl.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SQL] psql in the command line Thread-Index: AcYhyPtPyMqQD6JTTBiN0CQtqtpAbwADZ1MQ From: "Owen Jacobson" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.08 required=5 tests=[AWL=0.080] X-Spam-Score: 0.08 X-Spam-Level: X-Archive-Number: 200601/168 X-Sequence-Number: 23957 Alvaro Herrera wrote: > Aniko.Badzong@swisscom.com wrote: >=20 > > test:/opt/pgsql# echo "copy test from '/data/log/bla';" | psql logdb > > COPY > >=20 > > But when I try to execute it as root user I get the following error: > >=20 > > [est/data/log] su - postgres -c "echo 'copy test from=20 > /data/log/bla;'| > > psql logdb" > > ERROR: syntax error at or near "/" at character 16 > > LINE 1: copy test from /data/log/bla; >=20 > This is clearly not the same line. The quotes are not in the same > position as in the line above. >=20 > 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