Re: Column names and datatypes

From: Mike Mascari <mascarm(at)mascari(dot)com>
To: Glenn Sullivan <glenn(dot)sullivan(at)varianinc(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Column names and datatypes
Date: 2004-05-14 19:47:31
Message-ID: 40A52253.3070504@mascari.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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/static/information-schema.html

HTH,

Mike Mascari

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gaetano Mendola 2004-05-14 19:53:07 Re: slow query if add order by
Previous Message Carl E. McMillin 2004-05-14 19:43:43 Re: Column names and datatypes