Re: Walking a view to find all source tables
От | Tom Lane |
---|---|
Тема | Re: Walking a view to find all source tables |
Дата | |
Msg-id | 29900.1021829485@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Walking a view to find all source tables ("Joel Burton" <joel@joelburton.com>) |
Ответы |
Re: Walking a view to find all source tables
|
Список | pgsql-general |
"Joel Burton" <joel@joelburton.com> writes: > During some debugging of a database tonight, I wrote this function that > calls a view, examines its source, and recursively tracks down all the > source tables. A few comments: > if rec.relkind = ''r'' then return ''''; Probably be better to punt whenever relkind <> 'v', instead. > def := ev_action from pg_rewrite where ev_Class=rec.oid; Will tend to fail if view has rules other than select (insert, delete, update). You'd better restrict the ev_type field too. Also, I'd suggest making the internal recursion pass table oid not name; will be a lot easier to adapt to 7.3, wherein relname is not unique. (Although there may be better ways to do the whole thing in 7.3, anyway --- need to review Rod Taylor's pg_depend patch again, but probably some form of that will get in there.) regards, tom lane
В списке pgsql-general по дате отправления: