Re: Examples of accessing postgresql with scripts? - Mailing list pgsql-novice

From Tom Lane
Subject Re: Examples of accessing postgresql with scripts?
Date
Msg-id 21047.1054401040@sss.pgh.pa.us
Whole thread Raw
In response to Re: Examples of accessing postgresql with scripts?  (hodges@xprt.net)
Responses Re: Examples of accessing postgresql with scripts?
List pgsql-novice
hodges@xprt.net writes:
> 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?

I dunno how you would do that on the shell-script side, but it's easy to
do the date arithmetic on the SQL side instead:

psql tom -c "SELECT * FROM firesides where date > (current_date + 3)"

            regards, tom lane

pgsql-novice by date:

Previous
From: hodges@xprt.net
Date:
Subject: Re: Examples of accessing postgresql with scripts?
Next
From: hodges@xprt.net
Date:
Subject: Re: Examples of accessing postgresql with scripts?