Received: from resy5.fzk.de (resy5.fzk.de [141.52.68.8]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f8I9JUd65664 for ; Tue, 18 Sep 2001 05:19:30 -0400 (EDT) (envelope-from ch@rodos.fzk.de) Received: by rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id LAA23488; Tue, 18 Sep 2001 11:19:52 +0200 (METDST) From: Haller Christoph Message-Id: <200109180919.LAA22407@rodos> Subject: Re: How to see the definition of an existing table? To: kw68@cornell.edu (ke wang) Date: Tue, 18 Sep 2001 11:19:08 METDST Cc: pgsql-sql@postgresql.org In-Reply-To: <5.1.0.14.2.20010914203358.00baabf8@postoffice.mail.cornell.edu>; from "ke wang" at Sep 17, 101 4:51 pm X-Mailer: Elm [revision: 212.4] X-Archive-Number: 200109/123 X-Sequence-Number: 4794 Within psql you can do commands like \d 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