dbTalk Databases Forums  

How can I get the Db Schema Info??

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss How can I get the Db Schema Info?? in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rajan Bhide
 
Posts: n/a

Default How can I get the Db Schema Info?? - 08-12-2004 , 12:51 AM






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

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


Reply With Quote
  #2  
Old   
Bruno Wolff III
 
Posts: n/a

Default Re: How can I get the Db Schema Info?? - 08-12-2004 , 01:52 AM






On Thu, Aug 12, 2004 at 11:21:30 +0530,
Rajan Bhide <rbhide (AT) nulinkinc (DOT) com> wrote:
Quote:
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?
If you use the -E option on psql you can see what queries it uses to
get the information. Much of this information is available through
the information schema. The postgres documentation has both information
about the system tables and the information schema.

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.