Re: Getting a list of fields in a table...

From: Frank Miles <fpm(at)u(dot)washington(dot)edu>
To: Rich Henry <rhenry(at)mvcc(dot)edu>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Getting a list of fields in a table...
Date: 2001-05-05 00:20:56
Message-ID: Pine.A41.4.33.0105041715400.20602-100000@mead5.u.washington.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I'm looking for a solution to getting the fields in a table without
> running some random query on the system, can anyone share
> the SQL with me to get this done and anything special that would
> need to be done with libpq would also be appreciated...

Dear Rich:

Sorry this isn't a complete answer. If you really need SQL
(rather than \d inside psql) there is a way to find out the SQL commands
psql uses to perform its special commands. This subject has been on
the newsgroup in the "recent past" -- sorry, don't have anything exact.
Alternatively you can invoke psql with a shell script, something like:
psql -s <database name> -t <table name>
which will cause the schema to be sent to stdout. I'm not sure what
you want to do via libpq, though once you have the SQL strings you could
use any number of methods to access the schema.

Hope this helps!

-frank

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ashley Clark 2001-05-05 00:25:14 Re: VACUUM is hanging
Previous Message Tom Lane 2001-05-05 00:11:41 Re: how to see rules