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

Re: find column OID types with information schema?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Whit Armstrong <armstrong(dot)whit(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: find column OID types with information schema?
Date: 2009-04-27 16:29:41
Message-ID: 5926.1240849781@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-general
Whit Armstrong <armstrong(dot)whit(at)gmail(dot)com> writes:
> However, there is no example that uses a schema + tablename.

If you're into masochism you can do that with a join of pg_class and
pg_namespace.  But what's usually easier for one-off queries is to
use the regclass converter:

select attname, atttypid from pg_attribute
where attrelid = 'myschema.mytable'::regclass;

Most likely you'll also want

... and attnum > 0 and not attisdropped

to keep down the clutter.

			regards, tom lane

In response to

Responses

pgsql-general by date

Next:From: Tom LaneDate: 2009-04-27 16:38:06
Subject: Re: Which header and lib files to use when compiling libpq-code?
Previous:From: Kynn JonesDate: 2009-04-27 16:27:37
Subject: Re: Which header and lib files to use when compiling libpq-code?

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