What is the trick for displaying column comments in views?
The query below works as expected when the table_schema includes tables,
however it shows nothing when the table_schema contains only views. I
tried putting the query into an inline statement as a column selection
in a wrapper query...I got all the table/column data but the comment
column values were all null.
There must be a way to display comments if I can display the
table/column definitions, especially since the query joins directly to
information_schema columns. What am I missing?
Thanks for your help!
Sue
select c.table_schema
,c.table_name
,c.column_name
,pd.description
from pg_catalog.pg_statio_all_tables st
,pg_catalog.pg_description pd
,information_schema.columns c
where pd.objoid = st.relid
and pd.objsubid = c.ordinal_position
and c.table_schema = st.schemaname
and c.table_name = st.relname
and c.table_schema = 'devops'
order by c.table_schema
,c.table_name
,c.column_name
;
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Susan E Hurst
Principal Consultant
Brookhurst Data LLC
Email: susan.hurst@brookhurstdata.com
Mobile: 314-486-3261