Re: How can I look at a recursive table dependency tree?
От | Greg Stark |
---|---|
Тема | Re: How can I look at a recursive table dependency tree? |
Дата | |
Msg-id | 4136ffa0905300407o1c93bb2csdcf8acd2e15d4a06@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: How can I look at a recursive table dependency tree? (Emi Lu <emilu@encs.concordia.ca>) |
Ответы |
Re: How can I look at a recursive table dependency tree?
|
Список | pgsql-general |
On Fri, May 29, 2009 at 5:10 PM, Emi Lu <emilu@encs.concordia.ca> wrote: > Is it possible to find all view names depend on one table? With 8.4 you can use a query like this (change 'messages' to your table name) This query could stand to be polished a bit though... WITH RECURSIVE tree AS ( SELECT 'messages'::regclass::text AS tree, 0 AS level, 'pg_class'::regclass AS classid, 'messages'::regclass AS objid UNION ALL SELECT tree || ' <-- ' || get_obj_description(pg_depend.classid, pg_depend.objid), level+1, pg_depend.classid, pg_depend.objid FROM tree JOIN pg_depend ON ( tree.classid = pg_depend.refclassid AND tree.objid = pg_depend.refobjid) ) SELECT tree.tree FROM tree WHERE level < 10 -- greg
В списке pgsql-general по дате отправления: