From: Seb <spluque@gmail.com>
To: pgsql-general@postgresql.org
Subject: column information from view
Date: Fri, 14 Sep 2018 14:35:20 -0500
Message-ID: <87o9cz3m9z.fsf@gmail.com> (raw)
Hello,
I'm trying to generate a table with information 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.
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 with this one, of course, is that it lists *all* columns
from the persistent view, instead of the subset of them in the temporary
view. Is there a better way to do that?
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: <87o9cz3m9z.fsf@gmail.com>
References: <87o9cz3m9z.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