SQL statement : list table details

From: "Dino Hoboloney" <whatever(at)whatever(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: SQL statement : list table details
Date: 2002-02-28 18:57:17
Message-ID: a5luq1$17ea$1@jupiter.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am looking for a SQL statement which would list table names, columns,
and column types of a specific DB. So far I have managed to find a statement
that lists all of the tables and columns in the DB with

SELECT a.attnum, a.attname AS field, c.relname AS table_name FROM pg_class
c, pg_attribute a WHERE c.relname NOT LIKE 'pg%' AND relkind = 'r' AND
a.attnum > 0 AND a.attrelid = c.oid ORDER BY table_name, attnum;

unfortunately I am unable to come up with a solution to listing the data
types for the columns listed. Any ideas?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Holger Marzen 2002-02-28 19:25:02 Re: Defunct postmasters
Previous Message Raymond O'Donnell 2002-02-28 18:46:39 SQL question - duplicate records from join