From: Haller Christoph <ch@rodos.fzk.de>
To: kw68@cornell.edu
Cc: pgsql-sql@postgresql.org
Subject: Re: How to see the definition of an existing table?
Date: Tue, 18 Sep 2001 11:19:08 METDST
Message-ID: <200109180919.LAA22407@rodos> (raw)
In-Reply-To: <5.1.0.14.2.20010914203358.00baabf8@postoffice.mail.cornell.edu>
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
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: ch@rodos.fzk.de, kw68@cornell.edu
Subject: Re: How to see the definition of an existing table?
In-Reply-To: <200109180919.LAA22407@rodos>
* 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