I was reading online about function on PostgreSQL and returns results In this links:
I was able to see it as expected with this query:
SELECT * FROM brand_hierarchy (id)
Functions returning a table (or setof) should be used in the FROM clause:
select *
from brand_hierarchy(1234)
I found this function crosstab
I think it is what you're looking for
https://www.postgresql.org/docs/9.3/tablefunc.html