Re: [SQL] How do I get column names? - Mailing list pgsql-sql

From neko@kredit.sth.szif.hu
Subject Re: [SQL] How do I get column names?
Date
Msg-id Pine.LNX.4.10.9912140143180.5706-100000@kredit.sth.szif.hu
Whole thread Raw
In response to How do I get column names?  ("Steven M. Wheeler" <swheeler@sabre.com>)
List pgsql-sql
On Mon, 13 Dec 1999, Steven M. Wheeler wrote:

> A simple question.
> 
> What is the best way to query the DB, to get the column names for a
> particular table?
SELECT attname FROM pg_attribute, pg_class WHERE pg_class.oid = attrleid   AND attnum>0 AND relname =
'particular_table';
In this way, in each tuple of the result can find a column name.
Or can use the simple:
SELECT * FROM particular_table LIMIT 1;
This query will be return with a single line, and you can get the column
names from the result. (PQfname).

The first way may a bit faster, but the second can work with user typed
querys too.
 Best Regards
--nek;(




pgsql-sql by date:

Previous
From: Mathijs Brands
Date:
Subject: Re: [SQL] System Attribute
Next
From: "Stoyan Genov"
Date:
Subject: SQL'92 web resources