Re: Getting a list of tables in a database with Perl - Mailing list pgsql-general

From Medi Montaseri
Subject Re: Getting a list of tables in a database with Perl
Date
Msg-id 3DDAB5F5.20600@intransa.com
Whole thread Raw
In response to Getting a list of tables in a database with Perl  (Andrew Magnus <xanadian99@yahoo.com>)
Responses Re: Getting a list of tables in a database with Perl
List pgsql-general
Try this from the command line....

psql -c "\d"

And if you want to bring this into a perl script, try

perl -e '$list = `psql -c "\\d" `; print "$list\n";'

A more readable version is

$list = ` psql -c "\\d" `;
print "$list \n";

Or use DBI and go after pg_tables;

Andrew Magnus wrote:

> I would like to know how I can fetch a list of existing tables in a
> database within a Perl script.  Could someone please tell me how this
> can be done, or, at least, a good reference to look it up?  Thanks.
>
>
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Yahoo! Web Hosting
> <http://rd.yahoo.com/hosting/mailsig/*http://webhosting.yahoo.com> -
> Let the expert host your site





pgsql-general by date:

Previous
From: Andrew Magnus
Date:
Subject: Getting a list of tables in a database with Perl
Next
From: "Andy Kriger"
Date:
Subject: select where expr in - result order?