How can I obtain tables' structure?
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
Paul Mookhachov <paul@pmfd.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'))
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
(_)-(_)
Import Notes
Reply to msg id not found: PaulMookhachov'smessageofFri04Dec1998102053+0300
Paul Mookhachov <paul@pmfd.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.
Show quoted text
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
(_)-(_)
Import Notes
Resolved by subject fallback
"Jackson, DeJuan" wrote:
How can I obtain information about tables' structure and list of
tables
using psql.lib or Pg.pm (perl package)?
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
Well. I use same way. But may be I can do "select" from some system table?
There are several tables called pg_*. They contain miscellaneous information,
but I can't understand it.
------------------------
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
Hey,
I did some messing around with this one night....
I haven't found anything comprehensive and totally conclusive, but I think
I made some progress that you may be able to build upon.
For all of those interested, I've attached some text that I wrote after I
was done "messing around." I would happily take any commentary that might
be initiated by this...
Hope this helps,
Bob
On Mon, 7 Dec 1998, Paul Mookhachov wrote:
Show quoted text
Return-Path: <owner-pgsql-general@hub.org>
Received: from hub.org (majordom@hub.org [209.47.148.200])
by farout.palaver.net (8.9.1/8.9.1) with ESMTP id JAA29182
for <bobd@palaver.net>; Mon, 7 Dec 1998 09:07:05 -0500
Received: from localhost (majordom@localhost)
by hub.org (8.9.1/8.9.1) with SMTP id IAA06502;
Mon, 7 Dec 1998 08:55:45 -0500 (EST)
(envelope-from owner-pgsql-general@hub.org)
Received: by hub.org (TLB v0.10a (1.23 tibbs 1997/01/09 00:29:32)); Mon, 07 Dec 1998 08:45:37 +0000 (EST)
Received: (from majordom@localhost)
by hub.org (8.9.1/8.9.1) id IAA04424
for pgsql-general-outgoing; Mon, 7 Dec 1998 08:45:34 -0500 (EST)
(envelope-from owner-pgsql-general@postgreSQL.org)
Received: from trends.net (root@clio.trends.ca [209.47.148.2])
by hub.org (8.9.1/8.9.1) with ESMTP id IAA04356
for <pgsql-general@postgreSQL.org>; Mon, 7 Dec 1998 08:45:20 -0500 (EST)
(envelope-from paul@pmfd.ru)
Received: from pmfd.pmfd.ru (pmfd.pmfd.ru [194.8.185.65])
by trends.net (8.8.8/8.8.8) with SMTP id FAA01679
for <pgsql-general@postgreSQL.org>; Mon, 7 Dec 1998 05:53:54 -0500 (EST)
Received: from bridge.pmfd.ru by pmfd.pmfd.ru id aa27100; 7 Dec 98 11:37 MSK
Message-ID: <366B9494.DB7C5713@pmfd.ru>
Date: Mon, 07 Dec 1998 11:40:52 +0300
From: Paul Mookhachov <paul@pmfd.ru>
Reply-To: paul@pmfd.ru
Organization: PMFD
X-Mailer: Mozilla 4.5 [en] (WinNT; I)
X-Accept-Language: ru
MIME-Version: 1.0
To: pgsql-general@postgreSQL.org
Subject: Re: [GENERAL] How can I obtain tables' structure?
References: <F10BB1FAF801D111829B0060971D839F54EF3E@cpsmail>
Content-Type: text/plain; charset=koi8-r
Content-Transfer-Encoding: 7bit
Sender: owner-pgsql-general@postgreSQL.org
Precedence: bulk"Jackson, DeJuan" wrote:
How can I obtain information about tables' structure and list of
tables
using psql.lib or Pg.pm (perl package)?
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
Well. I use same way. But may be I can do "select" from some system table?
There are several tables called pg_*. They contain miscellaneous information,
but I can't understand it.------------------------
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