PostgreSQL Division Count Return 0
-- generally it happens because count is integer
-- and division in count rounds the number to 0
-- my solution was to convert to float. Ex
select count(*)::float/sum(*)::float
....
GutoTrosla