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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-general by date

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