AGE() function

From: Michael Fork <mfork(at)toledolink(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: AGE() function
Date: 2001-03-14 19:35:14
Message-ID: Pine.BSI.4.21.0103141430590.4820-100000@glass.toledolink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dan Lyke 2001-03-14 19:43:18 MetaData
Previous Message Orion Henry 2001-03-14 19:08:48 Fast Inserts and Hardware Questions