Postgres usually returns that error if your function returns out parameters (column list) and no definition. This happens when you call the function as 'SELECT function()' instead of 'SELECT * FROM function().' When you use the latter, Postgres treats the result of the function as results of a normal query and return tuples as if it were from a table.
Could you try a query of the same function using the 'SELECT * FROM' method?