Skip site navigation (1) Skip section navigation (2)

答复: [ADMIN] How to use psql -c?

From: 周仁军 <zrj(at)shanda(dot)com(dot)cn>
To: "David F(dot) Skoll" <dfs(at)roaringpenguin(dot)com>,"Charles Haron" <charles(dot)haron(at)cognitive(dot)com>
Cc: <pgsql-admin(at)postgresql(dot)org>
Subject: 答复: [ADMIN] How to use psql -c?
Date: 2003-12-30 02:19:39
Message-ID: EMEILKNNMPPPHHJAFGIEAELFCHAA.zrj@shanda.com.cn (view raw or flat)
Thread:
Lists: pgsql-admin
           u's PATH have no problem?

-----原始邮件-----
发件人: pgsql-admin-owner(at)postgresql(dot)org [mailto:pgsql-admin-owner(at)postgresql(dot)org]代表 David F. Skoll
发送时间: 2003年12月30日 6:24
收件人: Charles Haron
抄送: pgsql-admin(at)postgresql(dot)org
主题: Re: [ADMIN] How to use psql -c?


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.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.556 / Virus Database: 348 - Release Date: 2003-12-26

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.556 / Virus Database: 348 - Release Date: 2003-12-26
 

In response to

pgsql-admin by date

Next:From: vidhya baskaranDate: 2003-12-30 03:58:25
Subject: switching postgres from windows to linux
Previous:From: Charles HaronDate: 2003-12-29 22:53:59
Subject: Re: How to use psql -c?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group