How can I obtain tables' structure?

Поиск
Список
Период
Сортировка
Искать

How can I obtain tables' structure?

От:
Paul Mookhachov <paul@pmfd.ru>
Дата:
Hi!

How can I obtain information about tables' structure and list of tables
using psql.lib or Pg.pm (perl package)?

Thanx.


------------------------
Paul E Mookhachov                  paul@pmfd.ru
System administrator of            phone: +7 /812/ 329-8102
St-Petersburg Interbank            St-Petersbirg
Financial House                    B.Zelenina st, 24

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

От:
sdupille@i-france.com (Stéphane Dupille)
Дата:
Paul Mookhachov  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 ' ($req = $cbase->exec ('select * from table'))
	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@i-france.com
(_)-(_)
FAQ