Re: Field list from table

From: Christopher Browne <cbbrowne(at)acm(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Field list from table
Date: 2004-02-26 13:08:56
Message-ID: m365duyolz.fsf@wolfe.cbbrowne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Jan Pips" <jan_pips(at)op(dot)pl> wrote:
> How can I, using SELECT, get the full list of fields from a given table?

portfolio=# select column_name, data_type from information_schema.columns where table_catalog = 'portfolio' and table_schema = 'public' and table_name = 'stocktxns';
column_name | data_type
-------------+--------------------------
symbol | character varying
date | timestamp with time zone
price | numeric
quantity | numeric
(4 rows)

information_schema.columns has additional columns to provide
information about numeric precision, string widths, and such...
--
"cbbrowne","@","ntlug.org"
http://www.ntlug.org/~cbbrowne/postgresql.html
Rules of the Evil Overlord #4. "Shooting is not too good for my
enemies." <http://www.eviloverlord.com/>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Kumar 2004-02-26 13:51:37 Return more than a record
Previous Message Philip J. Boonzaaier 2004-02-26 10:18:57 Triggers