|< < 43 > >|

Postgres Stored Procedures

A function can return a table

Use 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 );

Example

Find all employees who work for the employee with id x_id, either directly or indirectly.

I.e., Traverse the hierarchy recursively.

Reminder

|< < 43 > >|