pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: [SQL] how to retrieve...
2+ messages / 2 participants
[nested] [flat]
* Re: [SQL] how to retrieve...
@ 1999-04-09 13:17 ZioBudda <michel@michel.enter.it>
0 siblings, 1 reply; 2+ messages in thread
From: ZioBudda @ 1999-04-09 13:17 UTC (permalink / raw)
To: Margarita Barvinok <brita@math.lsa.umich.edu>; +Cc: pgsql-sql
On Wed, 7 Apr 1999, Margarita Barvinok wrote:
>
> Try in psql
> \d <table name>
> Is this right answer on your question?
no, I need it via a query...
I want to recreate the structure of a table if I know the name of the
table.
ciaoz
Ho talmente fame che il mio stomaco fa tutt'uno con la spina dorsale
--
Michel <ZioBudda> Morelli michel@michel.enter.it
http://ziobudda.enter.it
Problemi con Linux ? mailto:linux@saturn.media.dsi.unimi.it
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] how to retrieve...
@ 1999-04-09 23:37 Ross J. Reedstrom <reedstrm@rice.edu>
parent: ZioBudda <michel@michel.enter.it>
0 siblings, 0 replies; 2+ messages in thread
From: Ross J. Reedstrom @ 1999-04-09 23:37 UTC (permalink / raw)
To: pgsql-sql
ZioBudda wrote:
>
> On Wed, 7 Apr 1999, Margarita Barvinok wrote:
>
> >
> > Try in psql
> > \d <table name>
> > Is this right answer on your question?
>
> no, I need it via a query...
> I want to recreate the structure of a table if I know the name of the
> table.
>
This is in the FAQ - but the answer there is 'look at the source and see
how \d tablename
does it with queries' ;-)
The freshly beta'd V 6.5 has a new optin '-E' (Explain?) where it will
show you the queries psql uses to get at the system table stuff. I
learned by poking arounf the source of pgaccess.tcl, which is included
in the distribution. Here's a partial example from one of my tables:
idas_proto=> \d "Teams"
Table = Teams
+----------------------------------+----------------------------------+-------+
| Field | Type |
Length|
+----------------------------------+----------------------------------+-------+
| TeamID | int4 not null
| 4 |
| TeamName | text
| var |
| TeamShortName | text
| var |
| TeamIDASRep | int4
| 4 |
| TeamLeader | int4
| 4 |
| TeamMission | text
| var |
| TeamDescription | text
| var |
| TeamImage | text
| var |
+----------------------------------+----------------------------------+-------+
Index: Teams_pkey
idas_proto=> select attname from pg_attribute pa, pg_class pc where
pa.attrelid=pc.oid and pc.relname='Teams';
attname
---------------
cmax
xmax
cmin
xmin
oid
ctid
TeamID
TeamName
TeamShortName
TeamIDASRep
TeamLeader
TeamMission
TeamDescription
TeamImage
(14 rows)
idas_proto=>
--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~1999-04-09 23:37 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-04-09 13:17 Re: [SQL] how to retrieve... ZioBudda <michel@michel.enter.it>
1999-04-09 23:37 ` Ross J. Reedstrom <reedstrm@rice.edu>
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