Postgres Stored ProceduresA function can return a tableUse a table-returning function for computing results that cannot be expressed in SQL easily, or at all. Schema
create table Employee(
emp_id int not null primary key,
boss_id int references Employee,
name varchar not null
);
ExampleFind all employees who work for the employee with id x_id, either directly or indirectly. I.e., Traverse the hierarchy recursively. |