From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | stan <stanb(at)panix(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How to get the OID of a view |
Date: | 2020-05-22 16:26:03 |
Message-ID: | CAKFQuwYX28ZqrOkpt5=F-S_xnX=7=eOG+isW-iUG8Q_o-_CAPA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, May 22, 2020 at 9:15 AM stan <stanb(at)panix(dot)com> wrote:
> I am trying to write a query to return the names, and data types of all the
> columns in a view. It has been pointed out to me that the best approach
> would be using pg_catalog. OK, so I found pg_view, which I can get the
> names
> of a the views from and pg_attribute which can give me the column names,
> but it looks like i need to join this on OID, and pg_table does not have
> that data.
>
>
The table you want is pg_class:
https://www.postgresql.org/docs/12/catalog-pg-class.html
If the system views listed in [1] don't provide you what you need you need
to fall-back to the system tables listed in [2].
[1] https://www.postgresql.org/docs/12/views-overview.html
[2] https://www.postgresql.org/docs/12/catalogs-overview.html
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Ribe | 2020-05-22 18:30:02 | query, probably needs window functions |
Previous Message | Adrian Klaver | 2020-05-22 16:25:37 | Re: How to get the OID of a view |