I have a simple function that needs to return an integer from a select statement. This is it:
CREATE OR REPLACE FUNCTION validate(_identityid integer, _postid