James David Smith <james(dot)david(dot)smith(at)gmail(dot)com> writes:
> When I run my SQL for 50 people it's fine. 1 person is fine. A
> thousand people it's fine. But when I try and run it for the whole
> dataset I'm given this error:
> ERROR: value out of range: underflow
> ****************Error *******************
> Error: Value out of range: underflow
> SQL state: 22003
This looks like an arithmetic problem not a SQL problem. Is your
calculation working with very small floating-point values anywhere?
regards, tom lane