Re: AGE() function - Mailing list pgsql-general

From Stephan Szabo
Subject Re: AGE() function
Date
Msg-id Pine.BSF.4.21.0103141147170.6508-100000@megazone23.bigpanda.com
Whole thread Raw
In response to AGE() function  (Michael Fork <mfork@toledolink.com>)
List pgsql-general
On Wed, 14 Mar 2001, Michael Fork wrote:

> radius=# SELECT count(*) FROM radacct WHERE age(now(), tstamp) > '6
> months'::interval;
>  count
> --------
>  128378
> (1 row)
>
> -- Up until this points everything makes sense, however what follows
> -- does not
>
> radius=# SELECT count(*) FROM radacct WHERE age(tstamp, now()) > '6 months
> ago'::interval;
>   count
> ---------
>  1988641
> (1 row)
>
> -- Shouldn't this be equal to the previous query (flipped the arguments
> -- and added 'ago'

I'd guess that since 6 months ago is effectively a negative interval,
wouldn't you want to be comparing  <'6 months ago'::interval for the
same effect?
(a-b>c -> b-a<-c or something)


pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Case Insensitive CHECK CONSTRAINTs
Next
From: Dan Lyke
Date:
Subject: MetaData