473,408 Members | 1,968 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,408 software developers and data experts.

Column names and datatypes

I need to acquire the list of all column names and datatypes
from a table through the JDBC interface using an sql command.
What I want is available in "psql" with the "\d tablename"
command, but I cannot figure out how to get these via an sql
command. Can anyone help?

Thanks,

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

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

Nov 23 '05 #1
3 1086
Use getMetadata of Connection. According to jdocs, the DatabaseMetaData
object can probably give you what you are looking for.

Carl <|};-)>

-----Original Message-----
From: pg*****************@postgresql.org
[mailto:pg*****************@postgresql.org] On Behalf Of Glenn Sullivan
Sent: Friday, May 14, 2004 12:23 PM
To: pgsql-general
Subject: [GENERAL] Column names and datatypes
I need to acquire the list of all column names and datatypes from a table
through the JDBC interface using an sql command. What I want is available in
"psql" with the "\d tablename" command, but I cannot figure out how to get
these via an sql command. Can anyone help?

Thanks,

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

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

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #2
Glenn Sullivan wrote:
I need to acquire the list of all column names and datatypes
from a table through the JDBC interface using an sql command.
What I want is available in "psql" with the "\d tablename"
command, but I cannot figure out how to get these via an sql
command. Can anyone help?


You can either query the information_schema's tables and views, or
you can start psql with the '-E' switch and view the queries its
sending and modify them to fit your requirements.

http://www.postgresql.org/docs/7.4/s...on-schema.html

HTH,

Mike Mascari
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #3
Carl,

That is what I need. Thanks.

Glenn

Carl E. McMillin wrote:
Use getMetadata of Connection. According to jdocs, the DatabaseMetaData
object can probably give you what you are looking for.

Carl <|};-)>

-----Original Message-----
From: pg*****************@postgresql.org
[mailto:pg*****************@postgresql.org] On Behalf Of Glenn Sullivan
Sent: Friday, May 14, 2004 12:23 PM
To: pgsql-general
Subject: [GENERAL] Column names and datatypes
I need to acquire the list of all column names and datatypes from a table
through the JDBC interface using an sql command. What I want is available in
"psql" with the "\d tablename" command, but I cannot figure out how to get
these via an sql command. Can anyone help?

Thanks,

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

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

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Sanjay Minni | last post by:
What is the datatype to be used for Primary Key columns for most optimised access given that - There will be a single column primary key only - The values will only be integers (but as...
0
by: Carl | last post by:
Hi, I have found a way to map attributes (columns) to column headings. But this runs really slow. Is there a way to improve it? Thanks, Carl <?xml version="1.0" encoding="utf-8" ?>...
4
by: John A Fotheringham | last post by:
I have a table that tracks GPS records broadly speaking as follows ts DATETIME username VARCHAR(16) ... GPS data ... I want to select the most recent GPS data for each distinct user. That...
16
by: Josué Maldonado | last post by:
Hello list, The TCL trigger that uses NEW and OLD arrays failed after after I removed a unused column, now I got this error: pltcl: Cache lookup for attribute '........pg.dropped.24........'...
3
by: Harry Whitehouse | last post by:
How might one go about this. I know how to select data records, but suppose I wanted to fill a datagrid with the column names in a specified table? How would I start? TIA Harry
0
by: zacks | last post by:
I am trying to use the Microsoft Text Driver to access data in a text file via ODBC calls. Everything has worked fine so far. I am now trying to implement support for a file that has a special...
1
by: Henri Schomäcker | last post by:
Hi folks, what I need is a kind of 2D-Array which should, in the end, represent a typical html-table and which should be sortable by column. I thought of an implementation, where an vector...
8
by: alex | last post by:
Thanks in advance for any help. I'm trying to attempt the following with one table/query. I have a table called TABLE_1 It has the following fields: SSN TITLE LOCATION 322 EX DALLAS...
2
by: Charleees | last post by:
Hi all, I have a DataGrid with Template Columns..... There are LAbels,Linkbuttons in the Single Row.. I have to set the Constant Column width for those Template Columns in Grid... Wat...
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: 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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.