Select all table column names for a specified tablename (per the system catalogs)

From: kevin kempter <kevin(at)kevinkempterllc(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Select all table column names for a specified tablename (per the system catalogs)
Date: 2008-09-22 22:06:06
Message-ID: E9AEE096-D4FD-4A3E-9FD5-FF134747B040@kevinkempterllc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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');

Any thoughts ?

Thanks in advance...

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Joshua Drake 2008-09-22 22:29:50 Re: Select all table column names for a specified tablename (per the system catalogs)
Previous Message Tena Sakai 2008-09-22 18:40:28 Re: question on pg_ctl