This question has been flagged
2463 Views

I wanted to fetch employee manager and all it's manger ids. I've tried using connectby:

select user_id  from hr_employee e   inner join resource_resource r on r.id = e.resource_id where e.id in  (  SELECT id FROM connectby('hr_employee', 'parent_id', 'id', 'id', 1, 0) AS t(id text, parent_id text, name text, name text)  WHERE parent_id is not null  )

but throwing error:

ERROR:  function connectby(unknown, unknown, unknown, unknown, integer, integer) does not existSELECT id FROM connectby('hr...

HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

Thanks!

Avatar
Discard

Hey Sushma,

connectby function is included in module 'tablefunc' and which not enabled by default in Postgres !.

To enable please fire command : CREATE EXTENSION tablefunc;

> So can you please make sure it and do your operations .for more info see below ref.link,

https://stackoverflow.com/questions/24898681/what-is-the-equivalent-postgresql-syntax-to-oracles-connect-by-start-with

Thanks!