Re: Finding recursive dependencies

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joel Jacobson <joel(at)gluefinance(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Finding recursive dependencies
Date: 2011-01-03 15:37:46
Message-ID: 19598.1294069066@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Joel Jacobson <joel(at)gluefinance(dot)com> writes:
> 2011/1/2 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
>> The thing you're missing is that implicit dependencies are really
>> bidirectional:

> So, basically it's not possible to define a recursive query only making use
> of pg_depend to build an entire dependency tree of all oids?
> It appears to me it's necessary to join the object type specific tables,
> such as pg_rewrite, to build a complete tree?

No, that's nonsense. The information is in pg_depend; it's just not
expressed in a way that makes it easy to scan it in a single recursive
query. If you could do something like

select base-case
union all
select objid ... where refobjid matches
union all
select refobjid ... where objid matches and deptype = 'i'

then it'd be easy, but you only get one UNION ALL per recursive query.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2011-01-03 15:49:20 Re: problem updating from form
Previous Message Adrian Klaver 2011-01-03 15:04:56 Re: pgloader an Indexes / was: Re: CSV-bulk import and defaults