Re: Getting a list of tables in a database with Perl

From: Medi Montaseri <medi(dot)montaseri(at)intransa(dot)com>
To: Andrew Magnus <xanadian99(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Getting a list of tables in a database with Perl
Date: 2002-11-19 22:06:45
Message-ID: 3DDAB5F5.20600@intransa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andy Kriger 2002-11-19 22:36:01 select where expr in - result order?
Previous Message Andrew Magnus 2002-11-19 21:52:52 Getting a list of tables in a database with Perl