How can I get the Db Schema Info??

From: "Rajan Bhide" <rbhide(at)nulinkinc(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Cc: "Ritesh Kumar Kakar" <rkakar(at)nulinkinc(dot)com>
Subject: How can I get the Db Schema Info??
Date: 2004-08-12 05:51:30
Message-ID: FF851C7EEB75954F9BCFB5CA117AB1ECFC326E@delta.nulinkinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

I have a query regarding the SCHEMA INFORMATION.
I require following information about a database i.e
1)How many tables are there?
2)What are their names?
3)What are the column types in each of the tables?
4)Primary key and foreign key information about a specific table.

This information is available by running commands like \d <table name>,
but what if
I want to execute a query to get this information.
i.e. I need the result in the recordset format for which I am require to
execute the query.
So, are there any sysobjects, System tables which stores the catalog
information?
Pg_tables is one but what about the column info (data types and all).

For e.g.:
select * from pg_tables where schemaname = 'public';
Gives all the user tables but I need the complete picture.

Thanks in advance,

Rajan Bhide

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Bruno Wolff III 2004-08-12 06:52:34 Re: How can I get the Db Schema Info??
Previous Message Josh Berkus 2004-08-12 04:48:50 Re: Help with query