Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1go9Ah-0007Vr-1r for pgsql-general@arkaria.postgresql.org; Mon, 28 Jan 2019 15:50:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1go9Af-00040C-8a for pgsql-general@arkaria.postgresql.org; Mon, 28 Jan 2019 15:50:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1go9Ae-000405-TY for pgsql-general@lists.postgresql.org; Mon, 28 Jan 2019 15:50:01 +0000 Received: from 24-182-127-154.static.stls.mo.charter.com ([24.182.127.154] helo=mail.brookhurstdata.net) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1go9AY-0007BR-21 for pgsql-general@lists.postgresql.org; Mon, 28 Jan 2019 15:49:59 +0000 Received: from mail.brookhurstdata.net (mail.brookhurstdata.net [10.1.5.12]) by mail.brookhurstdata.net (Postfix) with ESMTP id 4912388901D for ; Mon, 28 Jan 2019 09:49:53 -0600 (CST) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 28 Jan 2019 09:49:52 -0600 From: Susan Hurst To: pgsql-general@lists.postgresql.org Subject: Re: Displaying Comments in Views Organization: Brookhurst Data LLC Reply-To: susan.hurst@brookhurstdata.com Mail-Reply-To: susan.hurst@brookhurstdata.com In-Reply-To: <8183.1548689278@sss.pgh.pa.us> References: <8d48b89ca871afcce64a6b78d2db2b0c@mail.brookhurstdata.net> <8183.1548689278@sss.pgh.pa.us> Message-ID: <8c21bf3727cd98b3e80f1253b78e3ce2@mail.brookhurstdata.net> X-Sender: susan.hurst@brookhurstdata.com User-Agent: Roundcube Webmail/RCMAIL_VERSION List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thx for the great info. I appreciate your pointing me in the right direction. Sue --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Susan E Hurst Principal Consultant Brookhurst Data LLC Email: susan.hurst@brookhurstdata.com Mobile: 314-486-3261 On 2019-01-28 09:27, Tom Lane wrote: > Susan Hurst 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