Re: Examples of accessing postgresql with scripts?

From: Frank Bax <fbax(at)sympatico(dot)ca>
To: hodges(at)xprt(dot)net, pgsql-novice(at)postgresql(dot)org
Subject: Re: Examples of accessing postgresql with scripts?
Date: 2003-05-31 17:30:59
Message-ID: 5.2.0.9.0.20030531132654.00a020d0@pop6.sympatico.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

psql tom -c "SELECT * FROM firesides where age(date,now()) > '3 days'"

At 12:24 PM 5/31/03, hodges(at)xprt(dot)net wrote:

>This works for me:
>
>a=`eval date` # now $a is current date/time
>psql tom -c "SELECT * FROM firesides where date > '$a'"
>
>Now how to set $a to 3 days in the future?
>
>Thanks, Tom
>
>On 27 May 2003 at 17:47, Rory Campbell-Lange wrote:
>
> > psql -d <dbname> [-U <user>] -c "<command>"
> >
> > eg (if you do not need to log in as a user):
> > psql -d temporary -c "select * from people;"
> >
> > On 27/05/03, hodges(at)xprt(dot)net (hodges(at)xprt(dot)net) wrote:
> > > Can anyone direct me to some example bash scripts that
> > > execute queries thru psql?
> > >
> > > I need to check a bunch of tables for dates as a background
> > > job daily. Seems like bash, perl, or python might be good
> > > ways to do this. I think I know enough perl to do it but
> > > maybe bash or python would be better choices?
> >
> > --
> > Rory Campbell-Lange
> > <rory(at)campbell-lange(dot)net>
> > <www.campbell-lange.net>
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org
> >
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
>http://archives.postgresql.org

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Dima Tkach 2003-05-31 17:46:24 Re: why doesn't an index help my simple query?
Previous Message hodges 2003-05-31 17:17:36 Re: Examples of accessing postgresql with scripts?