dbTalk Databases Forums  

[BUGS] BUG #2767: Bug in avg(interval)

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


Discuss [BUGS] BUG #2767: Bug in avg(interval) in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Steffen Macke
 
Posts: n/a

Default [BUGS] BUG #2767: Bug in avg(interval) - 11-20-2006 , 07:26 PM







The following bug has been logged online:

Bug reference: 2767
Logged by: Steffen Macke
Email address: sdteffen (AT) gmail (DOT) com
PostgreSQL version: 8.1.4
Operating system: Windows XP
Description: Bug in avg(interval)
Details:

select avg(interval) is occasionally returning wrong
values:

Example:

select avg(test) from problem

returns

1 day 25:15:30

while the correct result is

2 days 01:15:30

Here is a table with sample data used:

CREATE TABLE problem (
test interval
);
COPY problem (test) FROM stdin;
1 day 20:39:28
4 days 00:02:53
1 day 00:03:01
2 days 02:08:34
01:33:34
3 days 07:05:35
\.

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #2767: Bug in avg(interval) - 11-20-2006 , 10:16 PM






"Steffen Macke" <sdteffen (AT) gmail (DOT) com> writes:
Quote:
select avg(test) from problem
returns
1 day 25:15:30
while the correct result is
2 days 01:15:30
This is not a bug; it's the result you're supposed to get.
But see justify_hours() if you want to fold up 24 hours to 1 day.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
  #3  
Old   
Steffen Macke
 
Posts: n/a

Default Re: [BUGS] BUG #2767: Bug in avg(interval) - 11-21-2006 , 01:34 PM



Tom,

Quote:
This is not a bug; it's the result you're supposed to get.
But see justify_hours() if you want to fold up 24 hours to 1 day.
Thanks! I must have overlooked that in the documentation.
Sorry for this.

Regards,

Steffen

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend


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.