From: Susan Hurst <susan.hurst@brookhurstdata.com>
To: Discuss List Postgres <pgsql-general@lists.postgresql.org>
Subject: Display View Columns and Their Source Tables and Columns
Date: Sun, 21 Apr 2019 14:33:16 -0500
Message-ID: <ca71fbd91c756d4b00de31f02b8f72d3@mail.brookhurstdata.net> (raw)
I'm so close but I can't quite figure out how to match view columns to
their source columns in a query. Looks like I might need yet another
table to join that makes that match, but I'm not having any success
finding such a bridge. Matching views to their source tables works well
enough. What am I missing? Is there a better approach?
I would welcome any comments or leads that you have.
Thanks for your help!
Sue
Here is what I have so far:
select vcu.view_name view_name
,c.column_name view_column
,vcu.table_schema source_schema
,vcu.table_name source_table
,vcu.column_name source_column
,c.is_updatable is_updatable
from information_schema.view_column_usage vcu
,information_schema.columns c
where vcu.view_schema = 'devops'
and vcu.table_schema in ('devops','chief','store')
and vcu.view_schema = c.table_schema
and vcu.view_name = c.table_name
and ************************ Help! *****************
order by vcu.view_name
,vcu.table_name
,c.column_name
;
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Susan E Hurst
Principal Consultant
Brookhurst Data LLC
Email: susan.hurst@brookhurstdata.com
Mobile: 314-486-3261
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: susan.hurst@brookhurstdata.com
Subject: Re: Display View Columns and Their Source Tables and Columns
In-Reply-To: <ca71fbd91c756d4b00de31f02b8f72d3@mail.brookhurstdata.net>
References: <ca71fbd91c756d4b00de31f02b8f72d3@mail.brookhurstdata.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox