Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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