I want to return 2 values with my SQL function:
CREATE OR REPLACE FUNCTION get_avg_prices(...) RETURNS table(avg_sale_price decimal, avg_rent_price decimal
Table functions (functions defined as returns table or returns setof) need to be used in the from clause like a table.
returns table
returns setof
from
So you need to use:
select * from get_avg_prices(...);
Only scalar functions (functions which return only a single value, e.g. a number) should be put into the select list.
select