Skip site navigation (1) Skip section navigation (2)

BUG #1637: age() function is giving different results

From: "J(dot)Simon Goodall" <simon(at)EstanciaViamonte(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1637: age() function is giving different results
Date: 2005-04-28 19:47:25
Message-ID: 20050428194725.0EA00F0D21@svr2.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      1637
Logged by:          J.Simon Goodall
Email address:      simon(at)EstanciaViamonte(dot)com
PostgreSQL version: 7.4.2
Operating system:   Linux
Description:        age() function is giving different results
Details: 

With the same query the age function is giving me two results, one as it
should be (34 years) and the other one is off by 1 hour, the query is a
single one so the results I asume should be the same.

I have tried finding the age(,) function in the source but had no luck.

Would appreciate some help, thx.

Simon.

Z SQL Method Z SQL Method at  /StockMan/select_birthdays

Famname 	Firstname 	Birth date 	Age
Surname1 	Name1 	1971-05-05 	34 years
Surname2 	Name2 	1964-05-05 	40 years 11 mons 30 days 23:00:00

SQL used:

SELECT famname, firstname, birth_date, age( DATE '2005-05-05'::date,
birth_date::date )
 FROM addresses
 WHERE
  EXTRACT ( day FROM timestamp '2005-05-05') = EXTRACT ( day FROM
birth_date)
 AND
  EXTRACT ( month FROM timestamp '2005-05-05') = EXTRACT ( month FROM 
birth_date);

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2005-04-28 22:26:05
Subject: Re: BUG #1637: age() function is giving different results
Previous:From: Mike G.Date: 2005-04-28 19:13:15
Subject: Re: BUG #1635: Failed to create process for initdb

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group