Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-admin by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group