pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sebastian P. Luque <spluque@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: column information from view
Date: Fri, 14 Sep 2018 21:23:44 -0500
Message-ID: <874lerjy6n.fsf@otaria.sebmel.org> (raw)
References: <87in373gpd.fsf@gmail.com>
	<2046.1536961948@sss.pgh.pa.us>
	<87a7oj3efm.fsf@gmail.com>
	<3830.1536964167@sss.pgh.pa.us>

On Fri, 14 Sep 2018 18:29:27 -0400,
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> "Sebastian P. Luque" <spluque@gmail.com> writes:
>> Tom Lane <tgl@sss.pgh.pa.us> 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.

Amazing!

Thank you all for these insights,
-- 
Seb





view thread (9+ messages)

Message-ID: <874lerjy6n.fsf@otaria.sebmel.org>
Permalink:  ../874lerjy6n.fsf@otaria.sebmel.org/
Also on:    postgresql.org/message-id/874lerjy6n.fsf@otaria.sebmel.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: spluque@gmail.com
  Subject: Re: column information from view
  In-Reply-To: <874lerjy6n.fsf@otaria.sebmel.org>
  References: <87in373gpd.fsf@gmail.com> <2046.1536961948@sss.pgh.pa.us> <87a7oj3efm.fsf@gmail.com> <3830.1536964167@sss.pgh.pa.us> <874lerjy6n.fsf@otaria.sebmel.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox