The following bug has been logged online:
Bug reference: 1637
Logged by: J.Simon Goodall
Email address: simon@EstanciaViamonte.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);