Re: column information from view

From: Sebastian P(dot) Luque <spluque(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: column information from view
Date: 2018-09-15 02:23:44
Message-ID: 874lerjy6n.fsf@otaria.sebmel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 14 Sep 2018 18:29:27 -0400,
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jerry Sievers 2018-09-15 02:29:44 Re: Vacuum not deleting tuples when lockless
Previous Message Tom Lane 2018-09-15 02:17:05 Re: Vacuum not deleting tuples when lockless