From: | "Shridhar Daithankar" <shridhar_daithankar(at)persistent(dot)co(dot)in> |
---|---|
To: | "psql_list" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How can i get the column names? |
Date: | 2002-10-28 14:01:57 |
Message-ID: | 3DBD90AD.28493.DA8C3@localhost |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 28 Oct 2002 at 13:57, freenet wrote:
> For an aplication i need to get only the column names!
> I'm trying to select the column names from a table, but without success.
> Can anybody instruct me how can i do it?
There are couple of ways..
1) If you are using C API, libpq allows you to retrieve field names given field
numbers and vice versa. You can use that.
2) You can query pg meta data. See if this query helps you..
select attrelid,attname from pg_attribute where attrelid=(select oid from
pg_class where relname='your table name');
Take a look at pg_attribute. The explanation is in manual under name of 'System
Catalogs;
HTH
Bye
Shridhar
--
Uncle Ed's Rule of Thumb: Never use your thumb for a rule. You'll either hit it
with a hammer or get a splinter in it.
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory Wood | 2002-10-28 14:05:15 | Re: www.postgresql.org/idocs/index.php?tutorial-table.html |
Previous Message | Shridhar Daithankar | 2002-10-28 14:01:55 | Re: Performance on very large indexed tables |