Re: How to get the OID of a view

From: Charles Clavadetscher <clavadetscher(at)swisspug(dot)org>
To: stan <stanb(at)panix(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to get the OID of a view
Date: 2020-05-22 16:25:32
Message-ID: 9CDA1CC3-1581-4E07-92E1-66CE1667042A@swisspug.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello
--------------

> On 22.05.2020, at 18:15, 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.
>
>
> --
> "They that would give up essential liberty for temporary safety deserve
> neither liberty nor safety."
> -- Benjamin Franklin
>
>

You find the oid of the views in pg_catalog.pg_class (relkind 'v').

Regards
Charles

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2020-05-22 16:25:37 Re: How to get the OID of a view
Previous Message Tom Lane 2020-05-22 16:24:15 Re: How to get the OID of a view