Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIIDK-0000lF-2e for pgsql-general@arkaria.postgresql.org; Sun, 21 Apr 2019 19:33:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hIIDI-000802-M4 for pgsql-general@arkaria.postgresql.org; Sun, 21 Apr 2019 19:33:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIIDI-0007zv-9Q for pgsql-general@lists.postgresql.org; Sun, 21 Apr 2019 19:33:20 +0000 Received: from 24-182-127-154.static.stls.mo.charter.com ([24.182.127.154] helo=mail.brookhurstdata.net) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hIIDG-0000Ma-0T for pgsql-general@lists.postgresql.org; Sun, 21 Apr 2019 19:33:19 +0000 Received: from mail.brookhurstdata.net (mail.brookhurstdata.net [10.1.5.12]) by mail.brookhurstdata.net (Postfix) with ESMTP id 9F80988901D for ; Sun, 21 Apr 2019 14:33:16 -0500 (CDT) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 21 Apr 2019 14:33:16 -0500 From: Susan Hurst To: Discuss List Postgres Subject: Display View Columns and Their Source Tables and Columns Organization: Brookhurst Data LLC Reply-To: susan.hurst@brookhurstdata.com Mail-Reply-To: susan.hurst@brookhurstdata.com Message-ID: X-Sender: susan.hurst@brookhurstdata.com User-Agent: Roundcube Webmail/RCMAIL_VERSION List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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