From: | "Shoaib Mir" <shoaibmir(at)gmail(dot)com> |
---|---|
To: | PostgreSQL <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Views dependency |
Date: | 2007-03-11 07:46:12 |
Message-ID: | bf54be870703102346j652ed713ube8dc73dd87d2f14@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I can see the following in pg_depend:
For view v1:
classid | objid | objsubid | refclassid | refobjid | refobjsubid | deptype
---------+--------+----------+------------+----------+-------------+---------
2618 | 153523 | 0 | 1259 | 153521 | 0 | n
2618 | 153523 | 0 | 1259 | 153521 | 0 | i
1247 | 153522 | 0 | 1259 | 153521 | 0 | i
2618 | 153526 | 0 | 1259 | 153521 | 1 | n
2618 | 153526 | 0 | 1259 | 153521 | 2 | n
2618 | 153526 | 0 | 1259 | 153521 | 3 | n
2618 | 153526 | 0 | 1259 | 153521 | 4 | n
2618 | 153526 | 0 | 1259 | 153521 | 5 | n
2618 | 153526 | 0 | 1259 | 153521 | 6 | n
2618 | 153526 | 0 | 1259 | 153521 | 7 | n
2618 | 153526 | 0 | 1259 | 153521 | 8 | n
For v2:
classid | objid | objsubid | refclassid | refobjid | refobjsubid | deptype
---------+--------+----------+------------+----------+-------------+---------
2618 | 153526 | 0 | 1259 | 153524 | 0 | n
2618 | 153526 | 0 | 1259 | 153524 | 0 | i
1247 | 153525 | 0 | 1259 | 153524 | 0 | i
and in pg_rewrite I got two entries for v1 and v2 as:
rulename | ev_class | ev_attr | ev_type | is_instead | ev_qual
---------+--------+----------+------------+----------+-------------+---------
_RETURN | 153521 | -1 | 1 | t | <>
_RETURN | 153524 | -1 | 1 | t | <>
Right now confused on how do I actually get the dependent views from this
kind of output... any ideas?
--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)
On 3/11/07, Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:
>
> Shoaib Mir escribió:
> > Suppose I have a view:
> >
> > create view v1 as select * from t1;
> >
> > and another view as:
> >
> > create view v2 as select * from v1;
> >
> > Now is there any query or any catalog table available by which I can get
> to
> > know the dependency (names of views on which v2 depends) for view v2?
>
> Yes, pg_depend has a row for v2 to indicate dependency on the pg_rewrite
> row, which in turn has an entry to indicate dependency on v1.
>
> --
> Alvaro Herrera
> http://www.CommandPrompt.com/
> The PostgreSQL Company - Command Prompt, Inc.
>
From | Date | Subject | |
---|---|---|---|
Next Message | Shoaib Mir | 2007-03-11 08:25:21 | Re: Views dependency |
Previous Message | Alvaro Herrera | 2007-03-11 06:38:08 | Re: Views dependency |