X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A1977D1C526 for ; Tue, 30 Dec 2003 17:29:12 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 28163-10 for ; Tue, 30 Dec 2003 13:28:24 -0400 (AST) Received: from cog-mail.csi (mail.cognitive.com [12.45.111.163]) by svr1.postgresql.org (Postfix) with ESMTP id 091CAD1B430 for ; Tue, 30 Dec 2003 13:28:23 -0400 (AST) Received: from [10.3.2.152] (10.3.2.152 [10.3.2.152]) by cog-mail.csi with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id ZNDZJG8G; Tue, 30 Dec 2003 10:29:14 -0700 Mime-Version: 1.0 (Apple Message framework v609) In-Reply-To: <20031230100709.GA1937@entoron.wiedau.de> References: <20031229140613.A20733@quality.qadas.com> <20031230100709.GA1937@entoron.wiedau.de> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <9ABC61DA-3AED-11D8-9F29-000A95AA0B44@cognitive.com> Content-Transfer-Encoding: 7bit From: Charles Haron Subject: Re: How to use psql -c? Date: Tue, 30 Dec 2003 10:28:38 -0700 To: pgsql-admin@postgresql.org X-Mailer: Apple Mail (2.609) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/343 X-Sequence-Number: 11849 On Dec 30, 2003, at 3:07 AM, Hans Peter Wiedau wrote: > On Mon, Dec 29, 2003 at 02:37:57PM -0700, Charles Haron wrote: > >> The following command works as I want: >> psql -c "DELETE FROM prg_dates_members WHERE confirm = 'f';" comfire >> >> I want to be able to run the above command as a cron job. I created a >> script with the following command, but I get "ERROR: Attribute 'f' >> not >> found": >> su - postgres -c 'psql -c "DELETE FROM prg_dates_members WHERE >> confirm = >> 'f';" comfire' >> >> What am I doing wrong? Is there a better way to do this? > > The bash manual page says: > > A single quote may not occur between single quotes, even when > preceded by a backslash. > > So, try this one: > > su - postgres -c "psql -c \"DELETE FROM prg_dates_members WHERE > confirm = 'f'\" comfire" > It works perfectly! Thank you very much. Chuck > cu, > > Hans Peter > > -- > ///// Quelltext AG -- Professional Software Services > // // Hans Peter Wiedau , CEO > // // Ostenhellweg 31, 44135 Dortmund, Germany > // \\/ fon +49 231 9503750, fax +49 231 9503751 > ////\\ Web http://www.quelltext.com > > ---------------------------(end of > broadcast)--------------------------- > TIP 8: explain analyze is your friend