test=# \dt ********* QUERY ********* SELECT c.relname as "Name", 'table'::text as "Type", u.usename as "Owner" FROM pg_class c, pg_user u WHERE c.relowner = u.usesysid AND c.relkind = 'r' AND c.relname !~ '^pg_' UNION SELECT c.relname as "Name", 'table'::text as "Type", NULL as "Owner" FROM pg_class c WHERE c.relkind = 'r' AND not exists (select 1 from pg_user where usesysid = c.relowner) AND c.relname !~ '^pg_' ORDER BY "Name" ************************* List of relations Name | Type | Owner -----------------+-------+---------- billing | table | postgres fees | table | postgres flgtatt | table | postgres test=# \d fees ********* QUERY ********* SELECT relhasindex, relkind, relchecks, reltriggers, relhasrules FROM pg_class WHERE relname='fees' ************************* ********* QUERY ********* SELECT a.attname, format_type(a.atttypid, a.atttypmod), a.attnotnull, a.atthasde f, a.attnum FROM pg_class c, pg_attribute a WHERE c.relname = 'fees' AND a.attnum > 0 AND a.attrelid = c.oid ORDER BY a.attnum ************************* ********* QUERY ********* SELECT c2.relname FROM pg_class c, pg_class c2, pg_index i WHERE c.relname = 'fees' AND c.oid = i.indrelid AND i.indexrelid = c2.oid ORDER BY c2.relname ************************* Table "fees" Attribute | Type | Modifier -----------+-----------------------+---------- type | character varying(10) | not null amount | numeric(8,2) | effdate | date | Index: fees_pkey