Stan Jacobs wrote:
> 
> This isn't quite what I'm looking for, though....  I can't run a script on
> that machine, so I need to retrieve it with an SQL query.  Ie. "SELECT *
> from data_key_table_name_something"... *smile*   Judging from the few
> responses so far, it doesn't sound like there's an easy way to do this.

You only need to run the script on the machine to get the initial sql
queries to which Omid referred.  You can then take those and run them
from any client.  Psql just shows you an example of how it does what
you're trying to do.  Not sure how easy it is to get everything right,
but psql and pgaccess both do what you seem to be trying to do. 
Here's a trimmed example from 7.0beta:

% psql -d emsdb -E 
emsdb=# create table foo (id serial, t timestamp);
CREATE
emsdb=# \d foo     
********* QUERY *********
SELECT relhasindex, relkind, relchecks, reltriggers, relhasrules
FROM pg_class WHERE relname='foo'
*************************

********* QUERY *********
SELECT a.attname, t.typname, a.attlen, a.atttypmod, a.attnotnull,
a.atthasdef, a.attnum
FROM pg_class c, pg_attribute a, pg_type t
WHERE c.relname = 'foo'
  AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid
ORDER BY a.attnum
*************************

...

Regards,
Ed Loehr

> 
> On Sun, 19 Mar 2000, omid omoomi wrote:
> 
> > Hi,
> > There are some system tables in any pg database which contain information
> > about table/field names/types and descriptions. use -e with psql command,
> > and look at the sql code when running /d commands.
> > regards.
> > Omid Omoomi
> >
> >
> > >From: Stan Jacobs <[EMAIL PROTECTED]>
> > >To: [EMAIL PROTECTED]
> > >Subject: [GENERAL] How to retrieve table definition in SQL
> > >Date: Sun, 19 Mar 2000 03:40:43 -0800 (PST)
> > >
> > >
> > >Hi everyone,
> > >
> > >This probably isn't a Postgres-specific question, but I'm hoping that
> > >someone knows the answer to this off the top of their heads... :-)
> > >
> > >I'd like to retrieve the table definition via SQL.  I'm using ColdFusion
> > >to access a PostgreSQL 6.5.3 database, and I'd like to retrieve the table
> > >info, field names/types/sizes, so that my Coldfusion page/script can
> > >dynamically build the html forms to edit the tables.
> > >
> > >Any ideas how to get to this in SQL?  I have another C++ class which
> > >builds nice table headers with this info, but ColdFusion doesn't seem to
> > >do that with the returned data.
> > >
> > >
> > >     Thanks!
> > >
> > >     - Stan -
> > >
> > >
> > >
> > >
> >
> > ______________________________________________________
> > Get Your Private, Free Email at http://www.hotmail.com
> >
> >

Reply via email to