Create a custom type which describes the structure of the rows returned:
CREATE TYPE func_return_type AS (column_name column_type, ...);
Then create the function:
CREATE OR REPLACE FUNCTION some_func (param_type, ...) RETURNS SETOF func_return_type AS ' SELECT columns FROM table WHERE condition; ' LANGUAGE 'SQL';
customfunctionsplpgsqlpostgresqlsqltypes