By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,968 Members | 1,620 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,968 IT Pros & Developers. It's quick & easy.

sql to extract the column details of a given table

P: 3
Hi,

I want to extract the below column details of a given table of PostgreSQL database.

1.column name
2.column data type
3.column length
4.column precision
5.column scale
6.column's default value

I can get this information from information_schema.columns view but i can't rely on this schema because the user can drop this schema. So i want to get the information from pg_catalog schema only.

Thanks,
Venkat Chitta,
Technical Consultant,
Infor,
Hyderabad, India.
Oct 30 '10 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 700
information_schema contains views. If you check the structure of the view for example
Expand|Select|Wrap|Line Numbers
  1.    \d information_schema.columns
  2.  
you will see the view definition and see tables the view is based on.
Nov 7 '10 #2

P: n/a
Hi,

I can't rely on this information_schema.columns view becuase this schema can be dropped by the schema owner unlike pg_catalog. So, i have to rely only on catalog tables and views.

Thanks,
venkat chitta.
Nov 7 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.