Sorry, my crystal ball is not working today.
What is the PostgreSQL version?
What is the O/S?
What is the function definition?
Where are you executing that command from?
What is the error in the postgres log?
Help us to help you. Please don't ask open ended questions
without providing as much detail as possible.