RE: [GENERAL] How can I obtain tables' structure?

From: "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com>
To: sdupille(at)i-france(dot)com, pgsql-general(at)postgreSQL(dot)org
Subject: RE: [GENERAL] How can I obtain tables' structure?
Date: 1998-12-04 17:53:30
Message-ID: F10BB1FAF801D111829B0060971D839F54EF3E@cpsmail
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Paul Mookhachov <paul(at)pmfd(dot)ru> writes:
>
> > Hi!
>
> Hi !
>
> > How can I obtain information about tables' structure and list of
> tables
> > using psql.lib or Pg.pm (perl package)?
>
> I think you got no wayt to do it directly, but with here's a
> trick :
> all you have to do is to make a request likt this :
> 'select * from <table>' ($req = $cbase->exec ('select * from table'))
I'd use 'select * from <table> where false'. It save the table scan and
you get the same info.

> now with '$req->nfields' you get the number of fields in the
> table.
> with '$fname = $req->fname($num_field)' you get the name of
> the field. and with '$ftype = $req->ftype($num_field)' you get the
> type of the field.
>
> You can get many other information on the table with some
> other commands... Just take a look at the perldoc page of Pg (to get
> it : 'perldoc Pg').
>
> > Thanx.
>
> You're welcome !
> --
> ___
> {~._.~} Stephane - DUST - Dupille
> ( Y ) You were dust and you shall turn into dust
> ()~*~() email : sdupille(at)i-france(dot)com
> (_)-(_)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message ZioBudda 1998-12-04 18:05:18 question 1
Previous Message Bruce Momjian 1998-12-04 16:17:21 Re: [GENERAL] Generic search