From: | Seb <spluque(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | column information from view |
Date: | 2018-09-14 19:35:20 |
Message-ID: | 87o9cz3m9z.fsf@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Kleiner | 2018-09-14 20:05:28 | Re: Convert interval to hours |
Previous Message | ik | 2018-09-14 19:11:13 | Query act different when doing by hand and by using a driver in app |