AGE() function - Mailing list pgsql-general

From Michael Fork
Subject AGE() function
Date
Msg-id Pine.BSI.4.21.0103141430590.4820-100000@glass.toledolink.com
Whole thread Raw
In response to Fast Inserts and Hardware Questions  (Orion Henry <orion@trustcommerce.com>)
Responses Re: AGE() function
List pgsql-general
Can someone tell me what I am missing here...

Thanks

Michael Fork - CCNA - MCP - A+
Network Support - Toledo Internet Access - Toledo Ohio

radius=# BEGIN;
BEGIN
radius=# select age(tstamp, now()) from radacct limit 1;
     age
--------------
 03:37:08 ago
(1 row)

radius=# select age(now(), tstamp) from radacct limit 1;
   age
----------
 03:37:08
(1 row)

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'

radius=# SELECT count(*) FROM radacct WHERE age(tstamp, now()) > '6
months'::interval;
 count
-------
     0
(1 row)

-- Since the previous query didn't work, I thought that this would return
-- the right number of rows, but I was wrong



pgsql-general by date:

Previous
From: Orion Henry
Date:
Subject: Fast Inserts and Hardware Questions
Next
From: Peter Eisentraut
Date:
Subject: Re: Fast Inserts and Hardware Questions