command line
testdb=> \dt List of relations Schema | Name | Type | Owner --------+-----------+-------+------- public | orderinfo | table | zwc (1 row) testdb=> testdb=> \d orderinfo Table "public.orderinfo" Column | Type | Modifiers --------------+--------------+------------------------------------------------------------------ orderinfo_id | integer | not null default nextval('orderinfo_orderinfo_id_seq'::regclass) customer_id | integer | not null date_placed | date | not null date_shipped | date | shipping | numeric(7,2) | Indexes: "orderinfo_pk" PRIMARY KEY,btree (orderinfo_id)
testdb=> SELECT testdb-> A .attname AS field,testdb-> T .typname AS TYPE,testdb-> A .attlen AS LENGTH,testdb-> A .attnotnull AS NOTNULL testdb-> FROM testdb-> pg_class C,testdb-> pg_attribute A,testdb-> pg_type T testdb-> WHERE testdb-> C .relname = 'orderinfo' testdb-> AND A .attnum > 0 testdb-> AND A .attrelid = C .oid testdb-> AND A .atttypid = T .oid; field | type | length | notnull --------------+---------+--------+--------- orderinfo_id | int4 | 4 | t customer_id | int4 | 4 | t date_placed | date | 4 | t date_shipped | date | 4 | f shipping | numeric | -1 | f (5 rows)