dbTalk Databases Forums  

[BUGS] BUG #1066: avg(age()) results months with more than 30 days

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1066: avg(age()) results months with more than 30 days in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
PostgreSQL Bugs List
 
Posts: n/a

Default [BUGS] BUG #1066: avg(age()) results months with more than 30 days - 01-25-2004 , 03:22 AM







The following bug has been logged online:

Bug reference: 1066
Logged by: Beda Szukics

Email address: beda (AT) muri-gries (DOT) ch

PostgreSQL version: 7.3.4

Operating system: linux

Description: avg(age()) results months with more than 30 days

Details:

Hello all

When I try to calculate the average age of the following birthdates I get
months with more than 30 days. Is this a bug?

I use version 7.3.4

These are the birthdates:


kongregation=> SELECT geb_dat FROM personen;
geb_dat
------------
20.12.1946
29.01.1948
21.03.1933
07.01.1954
22.08.1959
07.07.1913
30.11.1922
29.08.1925
07.01.1927
06.07.1928
25.09.1928
23.05.1929
25.04.1930
27.03.1933
21.12.1933
28.03.1937
03.02.1940
13.12.1941
13.02.1942
30.04.1937
25.08.1943
03.06.1964
26.01.1956
04.11.1957
27.12.1961
22.03.1911
30.11.1918
02.05.1957
08.03.1925
(29 rows)



Today (20.1.2004 german style) I get the answer:

kongregation=> SELECT AVG(AGE(geb_dat)) FROM personen ;
avg
------------------------------------
@ 65 years 9 mons 4 days 0.00 secs
(1 row)


Yesterday and the day before yesterday I got:

kongregation=> SELECT AVG(AGE('19.01.2004',geb_dat)) FROM personen ;
avg
------------------------------------------------------
@ 65 years 8 mons 32 days 2 hours 28 mins 57.93 secs
(1 row)

kongregation=> SELECT AVG(AGE('20.01.2004',geb_dat)) FROM personen ;
avg
-----------------------------------------------------
@ 65 years 8 mons 33 days 1 hour 39 mins 18.62 secs
(1 row)


BTW: I think having the result with years and days only would be a better
answer, what kind of months are counted in the present form?

Greetings Beda



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.