Lists: | pgsql-general |
---|
From: | salah jubeh <s_jubeh(at)yahoo(dot)com> |
---|---|
To: | pgsql <pgsql-general(at)postgresql(dot)org> |
Subject: | which view is used another views |
Date: | 2011-03-24 16:06:17 |
Message-ID: | 793296.58414.qm@web52707.mail.re2.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Hello,
How can I determine the views which are using a certain view.
Thanks in advance
From: | Emre Hasegeli <hasegeli(at)tart(dot)com(dot)tr> |
---|---|
To: | salah jubeh <s_jubeh(at)yahoo(dot)com> |
Cc: | pgsql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: which view is used another views |
Date: | 2011-03-24 16:54:53 |
Message-ID: | AANLkTinzNfFW_Bb+fDbU6rbv2tGw-2tGF5TsbZ4Ak6M+@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On 24 March 2011 18:06, salah jubeh <s_jubeh(at)yahoo(dot)com> wrote:
> Hello,
>
> How can I determine the views which are using a certain view.
>
>
Name of the view can be searched on the "view_definition" column of the
"views" view of the information schema.
From: | Raymond O'Donnell <rod(at)iol(dot)ie> |
---|---|
To: | salah jubeh <s_jubeh(at)yahoo(dot)com> |
Cc: | pgsql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: which view is used another views |
Date: | 2011-03-24 17:18:16 |
Message-ID: | 4D8B7CD8.1030501@iol.ie |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On 24/03/2011 16:06, salah jubeh wrote:
> Hello,
>
> How can I determine the views which are using a certain view.
If you're using pgAdmin, there's a "Dependants" tab which shows you the
objects depending on another object.
Otherwise, I think you can query the pg_catalog.pg_depend table, but I
don't know how you go about that.
Ray.
--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie
From: | salah jubeh <s_jubeh(at)yahoo(dot)com> |
---|---|
To: | rod(at)iol(dot)ie |
Cc: | pgsql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: which view is used another views |
Date: | 2011-03-24 18:15:01 |
Message-ID: | 181203.30473.qm@web52702.mail.re2.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Thanks guys
pg_depend seems Useful, I will check the manual.
Regards
________________________________
From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: salah jubeh <s_jubeh(at)yahoo(dot)com>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Sent: Thu, March 24, 2011 6:18:16 PM
Subject: Re: [GENERAL] which view is used another views
On 24/03/2011 16:06, salah jubeh wrote:
> Hello,
>
> How can I determine the views which are using a certain view.
If you're using pgAdmin, there's a "Dependants" tab which shows you the objects
depending on another object.
Otherwise, I think you can query the pg_catalog.pg_depend table, but I don't
know how you go about that.
Ray.
-- Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie
-- Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
From: | salah jubeh <s_jubeh(at)yahoo(dot)com> |
---|---|
To: | rod(at)iol(dot)ie |
Cc: | pgsql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: which view is used another views |
Date: | 2011-03-25 17:13:57 |
Message-ID: | 800561.88704.qm@web52708.mail.re2.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Hello Guys
The query in this function returns the dependency for level one. However, I need
the dependency for all level. I am still new with plpgsql so; how can I use
recursive function to return all dependency for all levels
CREATE OR REPLACE FUNCTION dependon (var text) RETURNS SETOF text AS
$BODY$
DECLARE
node record;
BEGIN
FOR node IN SELECT relname FROM pg_class WHERE OID in (
SELECT ev_class FROM pg_rewrite, pg_depend
WHERE pg_depend.objid = pg_rewrite.oid
AND deptype ='n'
AND refobjsubid = 1
AND refobjid::regclass::text = $1)
LOOP
IF node.relname IS NOT NULL THEN
RETURN NEXT depend(node.relname);
RETURN NEXT node.relname;
END IF;
END LOOP;
END
$BODY$
LANGUAGE 'plpgsql';
Regards
________________________________
From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: salah jubeh <s_jubeh(at)yahoo(dot)com>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Sent: Thu, March 24, 2011 6:18:16 PM
Subject: Re: [GENERAL] which view is used another views
On 24/03/2011 16:06, salah jubeh wrote:
> Hello,
>
> How can I determine the views which are using a certain view.
If you're using pgAdmin, there's a "Dependants" tab which shows you the objects
depending on another object.
Otherwise, I think you can query the pg_catalog.pg_depend table, but I don't
know how you go about that.
Ray.
-- Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie
-- Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
From: | Emre Hasegeli <hasegeli(at)tart(dot)com(dot)tr> |
---|---|
To: | salah jubeh <s_jubeh(at)yahoo(dot)com> |
Cc: | pgsql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: which view is used another views |
Date: | 2011-03-25 17:25:13 |
Message-ID: | AANLkTimYrtBE+zhKyxKbZeJM87NNBWm3WjyuAJm=niQw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On 25 March 2011 19:13, salah jubeh <s_jubeh(at)yahoo(dot)com> wrote:
> Hello Guys
>
> The query in this function returns the dependency for level one. However, I
> need the dependency for all level. I am still new with plpgsql so; how can I
> use recursive function to return all dependency for all levels
>
> CREATE OR REPLACE FUNCTION dependon (var text) RETURNS SETOF text AS
> $BODY$
> DECLARE
> node record;
> BEGIN
>
> FOR node IN SELECT relname FROM pg_class WHERE OID in (
> SELECT ev_class FROM pg_rewrite, pg_depend
> WHERE pg_depend.objid = pg_rewrite.oid
> AND deptype ='n'
> AND refobjsubid = 1
> AND refobjid::regclass::text = $1)
> LOOP
> IF node.relname IS NOT NULL THEN
>
> RETURN NEXT depend(node.relname);
> RETURN NEXT node.relname;
>
> END IF;
>
> END LOOP;
> END
> $BODY$
> LANGUAGE 'plpgsql';
>
>
You can do it with "WITH RECURSIVE" without PL/pgSQL:
http://www.postgresql.org/docs/current/static/queries-with.html
From: | salah jubeh <s_jubeh(at)yahoo(dot)com> |
---|---|
To: | Emre Hasegeli <hasegeli(at)tart(dot)com(dot)tr> |
Cc: | pgsql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: which view is used another views |
Date: | 2011-03-25 18:30:51 |
Message-ID: | 781348.20762.qm@web52703.mail.re2.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
I am using postgresql 8.3
Best Regard
Eng. Salah Al Jubeh
PalestinePolytechnic University
College of Applied Science
Computer Science
P.O. Box 198
Mobile:++97259369122
Tel:++97222254680
________________________________
From: Emre Hasegeli <hasegeli(at)tart(dot)com(dot)tr>
To: salah jubeh <s_jubeh(at)yahoo(dot)com>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Sent: Fri, March 25, 2011 6:25:13 PM
Subject: Re: [GENERAL] which view is used another views
On 25 March 2011 19:13, salah jubeh <s_jubeh(at)yahoo(dot)com> wrote:
Hello Guys
>
>The query in this function returns the dependency for level one. However, I need
>the dependency for all level. I am still new with plpgsql so; how can I use
>recursive function to return all dependency for all levels
>
>
>
>CREATE OR REPLACE FUNCTION dependon (var text) RETURNS SETOF text AS
>$BODY$
>DECLARE
> node record;
>BEGIN
>
> FOR node IN SELECT relname FROM pg_class WHERE OID in (
> SELECT ev_class FROM pg_rewrite, pg_depend
> WHERE pg_depend.objid = pg_rewrite.oid
> AND deptype ='n'
> AND refobjsubid = 1
> AND refobjid::regclass::text = $1)
> LOOP
> IF node.relname IS NOT NULL THEN
>
> RETURN NEXT depend(node.relname);
> RETURN NEXT node.relname;
>
> END IF;
>
> END LOOP;
>END
>$BODY$
>LANGUAGE 'plpgsql';
>
>
You can do it with "WITH RECURSIVE" without PL/pgSQL:
http://www.postgresql.org/docs/current/static/queries-with.html