Question Again

From: "Cristian D(dot) GAL" <gal(at)mail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Question Again
Date: 2000-09-06 15:57:02
Message-ID: Pine.LNX.4.21.0009061851020.3911-100000@papaya.opsynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


>> is there a solution to find infos about a table?
>> eg: I want to know what field names and their types has a certain table
>> from a db.

I read TFM and found -c option to 'psql' and came up with this trick:

#!/some/where/perl
use CGI qw(:standard);

my $table = param('table');
my $fields = `psql $DBNAME -h $DBHOST -U $DBUSER -c \"\\d $table\" -q`;
print $fields;
..

is there something a little more elegant than this?

Cristian GAL
gal(at)mail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Trewern, Ben 2000-09-06 16:08:24 Documentation of system tables.
Previous Message Frank Bax 2000-09-06 15:54:03 Re: Question