This is veryhelpull function, many uses percentage calculation in thier work and it will simplify the process. Percentage calculation is considered a basic math operation and I think postgresql should support it as a build-in function.
Seems like easy to implment isn't it?
It's a bit trickier than that, because you';ll have to deal with integers, real, double precision, etc. You may also want to deal with null values. I found it more useful to write a function that displays X as a percentage of Y, rounded to 1 digit to the right of the decimal point.