Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g16aF-0000Wq-C9 for pgsql-general@arkaria.postgresql.org; Sat, 15 Sep 2018 09:09:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g16aD-0008AW-A8 for pgsql-general@arkaria.postgresql.org; Sat, 15 Sep 2018 09:09:41 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g0tsP-00016G-CX for pgsql-general@lists.postgresql.org; Fri, 14 Sep 2018 19:35:37 +0000 Received: from [195.159.176.226] (helo=blaine.gmane.org) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1g0tsI-0002W8-PJ for pgsql-general@postgresql.org; Fri, 14 Sep 2018 19:35:36 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1g0tq9-00042u-1D for pgsql-general@postgresql.org; Fri, 14 Sep 2018 21:33:17 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-general@postgresql.org From: Seb Subject: column information from view Date: Fri, 14 Sep 2018 14:35:20 -0500 Organization: Church of Emacs Lines: 24 Message-ID: <87o9cz3m9z.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Cancel-Lock: sha1:A9gsmsTqmrpFPnLAbLUODSyMxRo= X-Host-Lookup-Failed: Reverse DNS lookup failed for 195.159.176.226 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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