473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

sql to extract the column details of a given table

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
2 3315
rski
700 Expert 512MB
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
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

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

Similar topics

2
by: gradeaaguy | last post by:
Hello everyone, I am new to ERWIN and I need helps from the experts out there. We are using ERWin 4.1.2771 and have reversed engineered some MS SQL Server 2000 databases. The problem we are...
5
by: Markus | last post by:
I tried this: ALTER TABLE Dokumente DROP COLUMN docPrioID but I get this errormessage: DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: COLUMN;ABLE Dokumente DROP;CONSTRAINT
13
by: annecarterfredi | last post by:
I'd like to add a new column to an existing table at a specific column location... Existing table definition: MyTable(Col1, Col2, Col3) I want to add a new column in MyTable and the new...
5
by: Veeru71 | last post by:
Given a table with an identity column (GENERATED BY DEFAULT AS IDENTITY), is there any way to get the last generated value by DB2 for the identity column? I can't use identity_val_local() as...
4
by: Farraige | last post by:
Hi I need your help... I am implementing the method that updates given table (table is represented as list of lists of strings) according to other table (some kind of merging)... This method...
9
by: mamoon | last post by:
hi all, Question: i have a table in a database of 6 columns and 630 rows.i want to add one new column to this table and also update this column starting from row 1 to row 630. System...
2
by: Rahul B | last post by:
I am new at DB2 . so please guide I am trying to change the Datatype of a column in the table. CREATE TABLE testschema.player ( NAME VARCHAR(120) NOT NULL, country ...
7
by: himanshupancholi | last post by:
Hi, I need to Copy all values of a column from one table to another. Below are the details: Source: STL_GRP table, VEND column Destination PARTNER table, VEND column. I am using the below...
1
by: abinesh.agarwal | last post by:
Hi , I want to update the column in a table based on the updation of the other column in the same table, but not getting the desired result. DDL: CREATE TABLE .( NULL,
1
by: venkat chitta | last post by:
Hi All, I want to know how to get a list of all indexes created on a column of a table in PostgreSQL. There is a program block in our application which do this in oracle, now i want to write the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.