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

Re: How to use psql -c?

From: Charles Haron <charles(dot)haron(at)cognitive(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: How to use psql -c?
Date: 2003-12-30 17:28:38
Message-ID: 9ABC61DA-3AED-11D8-9F29-000A95AA0B44@cognitive.com (view raw or flat)
Thread:
Lists: pgsql-admin
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 <hpw-nl(at)quelltext(dot)com>, 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


In response to

pgsql-admin by date

Next:From: Kenny DrobnackDate: 2003-12-30 20:44:03
Subject: forcing postgresql 7.3 to use crypt passwords
Previous:From: Ashok ChauhanDate: 2003-12-30 17:07:15
Subject: drop column

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