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-29 21:37:57
Message-ID: BC15ECC5.856%charles.haron@cognitive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> From: Michael Fuhr <mike(at)fuhr(dot)org>
> Date: Mon, 29 Dec 2003 14:06:13 -0700
> To: Charles Haron <charles(dot)haron(at)cognitive(dot)com>
> Cc: pgsql-admin(at)postgresql(dot)org
> Subject: Re: [ADMIN] How to use psql -c?
>
> On Mon, Dec 29, 2003 at 01:49:00PM -0700, Charles Haron wrote:
>>
>> Can someone give me an example of how to use the -c option of psql? I can't
>> seem to get it to work.
>
> What are you doing and what are the results? We can't tell you what's
> wrong unless you show us what you're doing and what's happening.
> Learning why something doesn't work can be just as useful as learning
> how to make it work.
>

My first problem was that I was using single quotes instead of double
quotes. But now I have another problem.

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?

Thanks,
Chuck

> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message David F. Skoll 2003-12-29 22:23:53 Re: How to use psql -c?
Previous Message Michael Fuhr 2003-12-29 21:06:13 Re: How to use psql -c?