From: | Bartosz Dmytrak <bdmytrak(at)gmail(dot)com> |
---|---|
To: | "Dr(dot) F(dot) Lee" <rl201(at)cam(dot)ac(dot)uk> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: View parsing |
Date: | 2012-07-04 14:20:01 |
Message-ID: | CAD8_UcYDzyU2pGmMvyGdvisBx4bZa-RKUY1WCSm_0U09sqQ1jg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
how about this one?
SELECT n.nspname, c.relname, a.attname
FROM pg_depend d
INNER JOIN pg_class c ON (c.oid = refobjid)
INNER JOIN pg_attribute a ON (c.oid = a.attrelid AND d.refobjsubid =
a.attnum)
INNER JOIN pg_namespace n ON (c.relnamespace = n.oid)
INNER JOIN pg_rewrite rw ON (d.objid = rw.oid)
WHERE rw.ev_class = '"MySchema"."MyViewName"'::regclass
ORDER BY n.nspname, c.relname, a.attname
This will answer for all involved tables and columns - not only produced by
a view, but also involved in joins and sub-queries.
Assumption: rules are deprecated and used only by PG internal engine (for
views).
If this assumption is not correct You should narrow pg_rewrite results to
find proper rule.
Reagards,
Bartek
From | Date | Subject | |
---|---|---|---|
Next Message | Claudio Freire | 2012-07-04 14:26:36 | Re: The need for clustered indexes to boost TPC-V performance |
Previous Message | Daniel Farina | 2012-07-04 13:39:38 | Re: The need for clustered indexes to boost TPC-V performance |