Re: parsing relname in pg_class - Mailing list pgsql-general

From Neil Conway
Subject Re: parsing relname in pg_class
Date
Msg-id 20020401172841.7df4ff7e.nconway@klamath.dyndns.org
Whole thread Raw
In response to parsing relname in pg_class  ("Johnson, Shaunn" <SJohnson6@bcbsm.com>)
List pgsql-general
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

pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: parsing relname in pg_class
Next
From: Tom Lane
Date:
Subject: Re: parsing relname in pg_class