Re: Conversion to 8.3

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Terry Lee Tucker <terry(at)chosen-ones(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Conversion to 8.3
Date: 2008-04-04 19:01:13
Message-ID: 47F67AF9.6000008@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Terry Lee Tucker wrote:
> Greetings:
>
> I am converting our application from 7.4.19 to 8.3.1. In the old scheme of
> things, I was generating an interval between two timestamps and evaluating
> the interval string in another set of trigger code. I was doing the
> following:
> IF new.ontime IS NOT NULL AND new.ontime ~* 'ago' THEN
>
If I understand your question correctly, you're seeking to determine if
new.ontime is "in the past". If so, compare with current_timestamp /
current_date as appropriate, eg:

IF new.ontime IS NOT NULL AND new.ontime < current_timestamp THEN

(Note that current_timestamp and current_date are constant within a
transaction, so they might not be suitable if you have really long
running transactions).

--
Craig Ringer

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Frank Miles 2008-04-04 19:02:20 Exception messages -> application?
Previous Message Gregory Stark 2008-04-04 18:52:34 Re: modules