Re: Examples of accessing postgresql with scripts?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: hodges(at)xprt(dot)net
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Examples of accessing postgresql with scripts?
Date: 2003-05-31 17:10:40
Message-ID: 21047.1054401040@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

hodges(at)xprt(dot)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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message hodges 2003-05-31 17:17:36 Re: Examples of accessing postgresql with scripts?
Previous Message hodges 2003-05-31 16:24:40 Re: Examples of accessing postgresql with scripts?