On Mon, 1 Apr 2002 16:29:34 -0500
"Johnson, Shaunn" <SJohnson6@bcbsm.com> wrote:
> I'm writing a perl script where I only want to parse
> out a list of tables from the database I'm connecting
> to.
If it's Perl with DBD, $dbh->tables() will get it for you.
> Is there an easier way to get a list of the tables ONLY
> with a select statement?
select * from pg_tables;
should do the trick. If you're not interested in system catalogs, filter
out all the relations that start with "pg_".
> I don't think I can pass a "\d"
> as a variable and get a return and I don't want to make
> a case statement for every possibility.
All these kinds of queries can be obtained by starting psql with "-E",
and then taking a look at how psql itself is getting the information.
Cheers,
Neil
--
Neil Conway <neilconway@rogers.com>
PGP Key ID: DB3C29FC