Search Postgresql Archives

Re: seeming overflow during avg() of intervals without errors/warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vick Khera <vivek@xxxxxxxxx> writes:
> So basically, it seems like however avg() on intervals is being computed it
> is overflowing somewhere without warning.

Hmmm ... yeah, it looks like interval_pl is missing any overflow check:

regression=# select '2147483648 days'::interval;
ERROR:  interval field value out of range: "2147483648 days"
LINE 1: select '2147483648 days'::interval;
               ^
regression=# select '2147483647 days'::interval;
    interval     
-----------------
 2147483647 days
(1 row)

regression=# select '2147483647 days'::interval + '1 day'::interval;
     ?column?     
------------------
 -2147483648 days
(1 row)

Somebody ought to fix that.

A larger question is whether it'd be worth the trouble for interval
avg() to use some wider internal representation so it could avoid
the overflow.  Given the lack of prior complaints I'm inclined to
suspect it's not.

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux