Factorial in pgplsql