Re: porting time calcs to PG

From: Bricklen Anderson <banderson(at)presinet(dot)com>
To: greg(at)bryantrecording(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: porting time calcs to PG
Date: 2006-12-07 23:56:25
Message-ID: 4578AA29.7070908@presinet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

greg(at)bryantrecording(dot)com wrote:
>
> I'm trying to port an MS statement that's a bit involved with
> timestamps, and I don't see anything in the docs to lead me forward.
> It's basically a select statement, looking for records with a timestamp
> within a certain range, where that range is calculated with one of the
> fields. The WHERE clause that I use in SQL Server is:
> getdate() + ((2100 + 5 + (9*Points)) / 86400) >= DueTime
>
> Where the numbers are actually parameters passed in to the function.
> Other than changine getdate() to now(), I'm not sure how to change the
> + interval to be effective. All the docs I see use something like
> interval '1 hour' - not sure how to put a calculated value in the
> quotes. Is this possible?
>
For the interval part, you can try
interval '1 minute' * <some number>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Davis 2006-12-08 00:03:01 Re: Asynchronous replication of a PostgreSQL DB to a
Previous Message Tom Lane 2006-12-07 23:51:40 Re: Online index builds