Re: column information from view

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Sebastian P(dot) Luque" <spluque(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: column information from view
Date: 2018-09-14 22:29:27
Message-ID: 3830.1536964167@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"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.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Williams 2018-09-14 23:07:51 Re: Slow shutdowns sometimes on RDS Postgres
Previous Message Sebastian P. Luque 2018-09-14 22:24:45 Re: column information from view