Re: strange system columns

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Colton A Smith <smith(at)cs(dot)utk(dot)edu>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: strange system columns
Date: 2006-01-12 05:16:05
Message-ID: 20060112051605.GA91092@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, Jan 05, 2006 at 03:17:02PM -0500, Colton A Smith wrote:
> SELECT attname, typname, attnum
> FROM pg_attribute INNER JOIN pg_type
> ON pg_attribute.atttypid = pg_type.typelem
> WHERE pg_attribute.attrelid = $oid (derived above)
> AND NOT attisdropped;

The join condition for pg_type should be against pg_type.oid, not
pg_type.typelem. A simplified version of your two queries is:

SELECT attname, atttypid::regtype, attnum
FROM pg_attribute
WHERE attrelid = 'organic_matter'::regclass AND NOT attisdropped;

--
Michael Fuhr

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Michael Fuhr 2006-01-12 05:23:19 Re: Rule for updating ipaddress on insertion
Previous Message Tom Lane 2006-01-12 05:11:16 Re: strange system columns