pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joshua Drake <jd@commandprompt.com>
To: kevin kempter <kevin@kevinkempterllc.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Select all table column names for a specified tablename (per the system catalogs)
Date: Mon, 22 Sep 2008 15:29:50 -0700
Message-ID: <20080922152950.294284b4@jd-laptop> (raw)
In-Reply-To: <E9AEE096-D4FD-4A3E-9FD5-FF134747B040@kevinkempterllc.com>
References: <E9AEE096-D4FD-4A3E-9FD5-FF134747B040@kevinkempterllc.com>

On Mon, 22 Sep 2008 16:06:06 -0600
kevin kempter <kevin@kevinkempterllc.com> wrote:

> Hi List;
> 
> I want to pull the list of column names from the system catalogs for
> a specified table. I only want column names, I want to exclude any
> index names, or other non-column name rows.  I got this far (see
> below) however this query produces additional rows with attname's
> like tableoid, cmax, xmax ctid, etc.
> 
> select attname from pg_attribute where attrelid = (select oid from  
> pg_class where relname = 'my_tablename');


SELECT column_name FROM information_schema.columns WHERE table_name =
'table';

Joshua D. Drake

> 
> Any thoughts ?
> 
> Thanks in advance...
> 
> 
> 


-- 
The PostgreSQL Company since 1997: http://www.commandprompt.com/ 
PostgreSQL Community Conference: http://www.postgresqlconference.org/
United States PostgreSQL Association: http://www.postgresql.us/
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate





view thread (3+ messages)  latest in thread

Message-ID: <20080922152950.294284b4@jd-laptop>
Permalink:  ../20080922152950.294284b4@jd-laptop/
Also on:    postgresql.org/message-id/20080922152950.294284b4@jd-laptop

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: jd@commandprompt.com, kevin@kevinkempterllc.com
  Subject: Re: Select all table column names for a specified tablename (per the system catalogs)
  In-Reply-To: <20080922152950.294284b4@jd-laptop>

* 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