Re: How to use psql -c? - Mailing list pgsql-admin

From David F. Skoll
Subject Re: How to use psql -c?
Date
Msg-id Pine.LNX.4.58.0312291722410.14524@shishi.roaringpenguin.com
Whole thread Raw
In response to Re: How to use psql -c?  (Charles Haron <charles.haron@cognitive.com>)
Responses Re: How to use psql -c?  (Charles Haron <charles.haron@cognitive.com>)
答复: [ADMIN] How to use psql -c?  (周仁军 <zrj@shanda.com.cn>)
List pgsql-admin
On Mon, 29 Dec 2003, Charles Haron wrote:

> 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'

Why not avoid shell quoting problems by doing it like this:

su - postgres -c psql comfire <<EOF
DELETE FROM prg_dates_members WHERE confirm = 'f';
EOF

Regards,

David.

pgsql-admin by date:

Previous
From: Charles Haron
Date:
Subject: Re: How to use psql -c?
Next
From: Charles Haron
Date:
Subject: Re: How to use psql -c?