From: | Joel Jacobson <joel(at)gluefinance(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Finding recursive dependencies |
Date: | 2011-01-03 01:02:04 |
Message-ID: | AANLkTi=J_Fzn-itJtT4gxraafs6fioXoPkrHyq6T3rMM@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
2011/1/2 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> Greg pointed out to start with that that query was unpolished (and,
> in fact, basically untested ...)
>
> I modified the query like this:
> which is at least a little bit clearer to look at than what you had.
>
Thanks a lot for the help!
I managed to partly solve the problem for views now anyway,
generated a topologically sorted create/drop sequence of views,
but it only joins the dependencies between views<->views and not all
objects.
I'll continue tomorrow including other dependencies as well, such as
functions.
Please have a look if you think I'm on the right track:
https://github.com/gluefinance/fsnapshot/blob/master/PLAYGROUND.sql
> The thing you're missing is that implicit dependencies are really
> bidirectional: you can't delete either object without deleting the
> other. So you have to scan outwards across reverse implicit
> dependencies, as well as forward dependencies of all types, if you
> want to find everything that must be deleted when dropping a given
> object. I don't immediately see any way to do that with a single
> recursive query :-(; you'd probably have to code up something in
> plpgsql.
>
> In the case at hand, b's view rule depends normally on a, and also
> implicitly on b.
>
>
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?
If so, that's fine, I just wondered if I had missed something making it
possible to avoid it.
--
Best regards,
Joel Jacobson
Glue Finance
From | Date | Subject | |
---|---|---|---|
Next Message | Dennis Gearon | 2011-01-03 04:26:34 | Re: uuid, COMB uuid, distributed farms |
Previous Message | Adrian Klaver | 2011-01-02 23:06:23 | Re: CSV-bulk import and defaults |