call function in stored procedure postgresql