column information from view

Поиск
Список
Период
Сортировка
От Sebastian P. Luque
Тема column information from view
Дата
Msg-id 87in373gpd.fsf@gmail.com
обсуждение исходный текст
Ответы Re: column information from view
Re: column information from view
Список pgsql-general
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


В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Query act different when doing by hand and by using a driver inapp
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Slow shutdowns sometimes on RDS Postgres