From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Joel Burton" <joel(at)joelburton(dot)com> |
Cc: | "Pgsql-General(at)Postgresql(dot) Org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Walking a view to find all source tables |
Date: | 2002-05-19 17:31:25 |
Message-ID: | 29900.1021829485@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Joel Burton" <joel(at)joelburton(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Jean-Michel POURE | 2002-05-19 18:08:18 | Re: [HACKERS] UTF-8 safe ascii() function |
Previous Message | Uros Gruber | 2002-05-19 16:15:55 | Re: LIMIT between some column |