Skip site navigation (1) Skip section navigation (2)

Re: find column OID types with information schema?

From: Whit Armstrong <armstrong(dot)whit(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: find column OID types with information schema?
Date: 2009-04-27 16:22:27
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
(I had accidentally replied to Tom only on my reply)

the OID's can be found as follows:

SELECT * FROM pg_attribute
  WHERE attrelid = (SELECT oid FROM pg_class WHERE relname = 'mytable');

from this page:

However, there is no example that uses a schema + tablename.


On Mon, Apr 27, 2009 at 11:53 AM, Whit Armstrong
<armstrong(dot)whit(at)gmail(dot)com> wrote:
> Thanks, Tom.
> So, it's more like this:
> select attname, atttypid from pg_attribute where attrelid = <attrelid
> of my table>;
> hmm, so how do I find the attrelid of my table?  I don't see it in pg_tables.
> -Whit
> On Mon, Apr 27, 2009 at 11:38 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Whit Armstrong <armstrong(dot)whit(at)gmail(dot)com> writes:
>>> Is it possible to find out the OID types of the columns of a table
>>> using the information schema?
>> No.  Type OIDs are a Postgres-ism so they are not reflected in the
>> standards-mandated contents of the information_schema.  If you want
>> OIDs you'll need to look at the underlying catalogs (pg_attribute
>> in particular).
>>                        regards, tom lane

In response to


pgsql-general by date

Next:From: Tom LaneDate: 2009-04-27 16:23:44
Subject: Re: how do you get there from here?
Previous:From: Bruce MomjianDate: 2009-04-27 16:22:06
Subject: Re: Cannot reattach to shared memory / Windows

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group