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 1g0waj-0003rl-M0 for pgsql-general@arkaria.postgresql.org; Fri, 14 Sep 2018 22:29:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g0wai-0003gD-1L for pgsql-general@arkaria.postgresql.org; Fri, 14 Sep 2018 22:29:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g0wah-0003fn-QF for pgsql-general@lists.postgresql.org; Fri, 14 Sep 2018 22:29:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g0waf-0006id-E1 for pgsql-general@lists.postgresql.org; Fri, 14 Sep 2018 22:29:31 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w8EMTRMn003831; Fri, 14 Sep 2018 18:29:27 -0400 From: Tom Lane To: "Sebastian P. Luque" cc: pgsql-general@lists.postgresql.org Subject: Re: column information from view In-reply-to: <87a7oj3efm.fsf@gmail.com> References: <87in373gpd.fsf@gmail.com> <2046.1536961948@sss.pgh.pa.us> <87a7oj3efm.fsf@gmail.com> Comments: In-reply-to "Sebastian P. Luque" message dated "Fri, 14 Sep 2018 17:24:45 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3829.1536964167.1@sss.pgh.pa.us> Date: Fri, 14 Sep 2018 18:29:27 -0400 Message-ID: <3830.1536964167@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "Sebastian P. Luque" writes: > Tom Lane wrote: >> Personally, I'd probably write it something like this: >> select pa.attnum, pa.attname, col_description(pa.attrelid, pa.attnum) >> from pg_attribute pa, pg_attribute ta where pa.attrelid = >> 'persistent_view'::regclass and ta.attrelid = >> 'temporary_view'::regclass and pa.attname = ta.attname order by >> pa.attnum; > Thank you Tom, this does seem more elegant, but I'd have to retrieve the > actual "attrelid" from the names of the two views somehow. That's what the regclass converter does for you. regards, tom lane