Re: AGE() function

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Michael Fork <mfork(at)toledolink(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: AGE() function
Date: 2001-03-14 19:49:52
Message-ID: Pine.BSF.4.21.0103141147170.6508-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alfred Perlstein 2001-03-14 19:56:32 Re: Case Insensitive CHECK CONSTRAINTs
Previous Message Peter Eisentraut 2001-03-14 19:46:38 Re: Fast Inserts and Hardware Questions