pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedField list from table
4+ messages / 4 participants
[nested] [flat]
* Field list from table
@ 2004-02-26 09:51 Jan Pips <jan_pips@op.pl>
2004-02-26 13:08 ` Re: Field list from table Christopher Browne <cbbrowne@acm.org>
2004-02-29 20:48 ` Re: Field list from table rixder@o2.pl
2004-03-01 05:30 ` Re: Field list from table Denis <sqllist@coralindia.com>
0 siblings, 3 replies; 4+ messages in thread
From: Jan Pips @ 2004-02-26 09:51 UTC (permalink / raw)
To: pgsql-sql
How can I, using SELECT, get the full list of fields from a given table?
Pips
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Field list from table
2004-02-26 09:51 Field list from table Jan Pips <jan_pips@op.pl>
@ 2004-02-26 13:08 ` Christopher Browne <cbbrowne@acm.org>
2 siblings, 0 replies; 4+ messages in thread
From: Christopher Browne @ 2004-02-26 13:08 UTC (permalink / raw)
To: pgsql-sql
"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/;
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Field list from table
2004-02-26 09:51 Field list from table Jan Pips <jan_pips@op.pl>
@ 2004-02-29 20:48 ` rixder@o2.pl
2 siblings, 0 replies; 4+ messages in thread
From: rixder@o2.pl @ 2004-02-29 20:48 UTC (permalink / raw)
To: Jan Pips <jan_pips@op.pl>; +Cc: pgsql-sql
On Thu, Feb 26, 2004 at 10:51:41AM +0100, Jan Pips wrote:
> How can I, using SELECT, get the full list of fields from a given table?
>
> Pips
>
>
Hi !
Try it:
select * from table limit 0;
rixder
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Field list from table
2004-02-26 09:51 Field list from table Jan Pips <jan_pips@op.pl>
@ 2004-03-01 05:30 ` Denis <sqllist@coralindia.com>
2 siblings, 0 replies; 4+ messages in thread
From: Denis @ 2004-03-01 05:30 UTC (permalink / raw)
To: pgsql-sql
To get the list.. use
SELECT a.attname as "Columns"
FROM pg_attribute a, pg_class c
WHERE c.relname = '<YOUR_TABLE_NAME>'
AND a.attnum > 0 AND a.attrelid = c.oid
ORDER BY a.attnum
Thanx
Denis
----- Original Message -----
From: "Jan Pips" <jan_pips@op.pl>
To: <pgsql-sql@postgresql.org>
Sent: Thursday, February 26, 2004 3:21 PM
Subject: [SQL] Field list from table
> How can I, using SELECT, get the full list of fields from a given table?
>
> Pips
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2004-03-01 05:30 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-02-26 09:51 Field list from table Jan Pips <jan_pips@op.pl>
2004-02-26 13:08 ` Christopher Browne <cbbrowne@acm.org>
2004-02-29 20:48 ` rixder@o2.pl
2004-03-01 05:30 ` Denis <sqllist@coralindia.com>
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