Re: creating a view that shows relation name -> OID

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin T(dot) Manley" <kmanley(at)qwest(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: creating a view that shows relation name -> OID
Date: 2001-03-13 18:13:39
Message-ID: 20388.984507219@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Kevin T. Manley" <kmanley(at)qwest(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-03-13 18:25:56 Re: Re: Data type for storing images?
Previous Message Bill Huff 2001-03-13 18:07:28 Re: creating a view that shows relation name -> OID