From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | susan(dot)hurst(at)brookhurstdata(dot)com |
Cc: | Discuss List Postgres <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Displaying Comments in Views |
Date: | 2019-01-28 15:27:58 |
Message-ID: | 8183.1548689278@sss.pgh.pa.us |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Susan Hurst <susan(dot)hurst(at)brookhurstdata(dot)com> writes:
> 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.
No surprise, since you're using pg_statio_all_tables as the source of
tables, and that contains, well, only tables.
I'm not quite sure why you'd choose that view anyway. Personally I'd
have gone directly to pg_class, and then probably filtered on relkind
if there were things I didn't want to see. Or you could use
information_schema.tables.
Also, I'm too lazy to check on how information_schema.columns defines
"ordinal_position", but I wonder if it tries to leave out dropped
columns, or might do so in future. That puts this join condition
at risk: "pd.objsubid = c.ordinal_position".
You'd likely be better off to join pg_class and pg_attribute to
pg_description, rather than working with proxies for them.
https://www.postgresql.org/docs/current/catalogs.html
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gierth | 2019-01-28 15:41:56 | Re: Displaying Comments in Views |
Previous Message | Durgamahesh Manne | 2019-01-28 15:20:12 | Re: Regarding query execution for long time |