pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Colton A Smith <smith@cs.utk.edu>
Cc: pgsql-admin@postgresql.org
Subject: Re: strange system columns
Date: Wed, 11 Jan 2006 22:16:05 -0700
Message-ID: <20060112051605.GA91092@winnie.fuhr.org> (raw)
In-Reply-To: <Pine.LNX.4.62.0601051447080.7355@cetus5.cs.utk.edu>
References: <Pine.LNX.4.62.0601051447080.7355@cetus5.cs.utk.edu>

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



view thread (3+ messages)

Message-ID: <20060112051605.GA91092@winnie.fuhr.org>
Permalink:  ../20060112051605.GA91092@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20060112051605.GA91092@winnie.fuhr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mike@fuhr.org, smith@cs.utk.edu
  Subject: Re: strange system columns
  In-Reply-To: <20060112051605.GA91092@winnie.fuhr.org>
  References: <Pine.LNX.4.62.0601051447080.7355@cetus5.cs.utk.edu> <20060112051605.GA91092@winnie.fuhr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox