From: Christopher Browne <cbbrowne@acm.org>
To: pgsql-sql@postgresql.org
Subject: Re: Field list from table
Date: Thu, 26 Feb 2004 08:08:56 -0500
Message-ID: <m365duyolz.fsf@wolfe.cbbrowne.com> (raw)
References: <c1kfka$2l33$1@mamut.aster.pl>
"Jan Pips" <jan_pips@op.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/;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: cbbrowne@acm.org
Subject: Re: Field list from table
In-Reply-To: <m365duyolz.fsf@wolfe.cbbrowne.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox