Re: Bug #534: factorial function - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Bug #534: factorial function
Date
Msg-id 18290.1007997395@sss.pgh.pa.us
Whole thread Raw
In response to Re: Bug #534: factorial function  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-bugs
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Yep, 0! sure looks like a bug.  We will fix it in 7.3.  Not sure about
> the double precision.  Comments?

It looks like we have three versions of factorial, for int2 int4 and
int8.  The version taking int2 is just plain wasted code space (perhaps
it predates the availability of automatic type conversions?)  The int4
and int8 versions both have a serious problem with lack of overflow
detection.  I'd be sorely tempted to replace all three by a single
function that takes integer and returns numeric.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug #531: libpq: Operations following PQfinish() work.
Next
From: Thomas Lockhart
Date:
Subject: Re: Bug #534: factorial function