| From: | Haller Christoph <ch(at)rodos(dot)fzk(dot)de> |
|---|---|
| To: | kw68(at)cornell(dot)edu (ke wang) |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: How to see the definition of an existing table? |
| Date: | 2001-09-18 11:19:08 |
| Message-ID: | 200109180919.LAA22407@rodos |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Within psql you can do commands like
\d <tablename>
to learn rudimentary information about
a table.
Try this to learn more sophisticated information
select u.usename, t.typname, a.attname, a.atttypid, a.attlen, a.attnotnull, a.attnum
from pg_user u, pg_type t, pg_attribute a
where u.usesysid = t.typowner
and t.typrelid = a.attrelid and t.typtype = 'c' and t.typname = 'pg_attribute'
where 'pg_attribute' should be replaced by the table's name you
are interested in.
Unfortunately, I don't know nothing about how to find the primary key
in a table definition.
But go for the PostgreSQL documentation - Chapter System Catalogs -
this should give you at least an idea which system catalog may
deliver the information.
Regards, Christoph
| From | Date | Subject | |
|---|---|---|---|
| Next Message | D'Arcy J.M. Cain | 2001-09-18 11:22:36 | Re: Out of free buffers... HELP! |
| Previous Message | Diehl, Jeffrey | 2001-09-18 07:07:47 | Re: Out of free buffers... HELP! |