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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to