From: Sebastian P. Luque <spluque@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: column information from view
Date: Fri, 14 Sep 2018 16:35:42 -0500
Message-ID: <87in373gpd.fsf@gmail.com> (raw)
Hello,
I'm trying to generate a table with information on columns from a
temporary view that simply selects a subset of columns from a persistent
view in a given schema. The persistent view joins a number of tables
with columns that may or may not have a description entered. I need a
table with a list of columns from the temporary view, and the matching
descriptions from the underlying persistent view.
Here's my attempt at listing the temporary view's columns and respective
descriptions:
SELECT cols.ordinal_position, cols.column_name,
col_description(cl.oid, cols.ordinal_position::INT)
FROM pg_class cl, information_schema.columns cols
WHERE cols.table_catalog='dbname' AND cols.table_schema='some_schema' AND
cols.table_name = 'persistent_view' AND cols.table_name = cl.relname
ORDER BY cols.ordinal_position::INT;
The problem, of course, is that it lists columns from the persistent
view, instead of the subset of them in the temporary view. Is there a
better way to do that? Hopefully this makes sense.
Thanks,
--
Seb
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: spluque@gmail.com
Subject: Re: column information from view
In-Reply-To: <87in373gpd.fsf@gmail.com>
References: <87in373gpd.fsf@gmail.com>
* 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