Re: creating a view that shows relation name -> OID - Mailing list pgsql-general

From Tom Lane
Subject Re: creating a view that shows relation name -> OID
Date
Msg-id 20388.984507219@sss.pgh.pa.us
Whole thread Raw
In response to creating a view that shows relation name -> OID  ("Kevin T. Manley" <kmanley@qwest.net>)
List pgsql-general
"Kevin T. Manley" <kmanley@qwest.net> writes:
> CREATE VIEW VW_FOO AS select pg_class.oid, relname from pg_class where
> relowner=27;
> fails with:
> Attribute 'oid' has a name conflict
> Name matches an existing system attribute

If you tried to create a table with a user column named 'oid' (or xmin
or any of the other system attribute names), you'd get the same error.

Views don't really have an oid column, but the system attribute names
are reserved anyway.

I'd recommend changing the name of the view's column, eg

    SELECT pg_class.oid AS reloid, ...

            regards, tom lane

pgsql-general by date:

Previous
From: Bill Huff
Date:
Subject: Re: creating a view that shows relation name -> OID
Next
From: Tom Lane
Date:
Subject: Re: Re: Data type for storing images?