On Thu, Jun 07, 2007 at 06:36:07PM -0400, Jon Sime wrote: > select n.nspname as table_schema, c.relname as table_name, > a.attname as column_name > from pg_catalog.pg_attribute a > join pg_catalog.pg_class c on (a.attrelid = c.oid) > join pg_catalog.pg_namespace n on (c.relnamespace = n.oid) > where c.relkind in ('r','v') and a.attnum > 0 > and n.nspname not in ('pg_catalog','information_schema') > order by 1,2,3 Don't forget "and not a.attisdropped" else you might get something like table_schema | table_name | column_name --------------+------------+------------------------------ public | foo | ........pg.dropped.2........ public | foo | col1 public | foo | col3 (3 rows) -- Michael Fuhr