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: 8ec76080904270922w4ee37c7cq9b50bc930bf06b86@mail.gmail.com (view raw or flat)
Thread:
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:
http://www.postgresql.org/docs/8.3/interactive/datatype-oid.html

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

-Whit

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

Responses

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-2014 The PostgreSQL Global Development Group