Re: [GENERAL] How to find names of tables in a database?

From: Simon Drabble <simon(at)fiddletrudge(dot)dyn(dot)ml(dot)org>
To: Valerie Mates <popcorn(at)tir(dot)com>
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] How to find names of tables in a database?
Date: 1998-10-14 23:22:33
Message-ID: Pine.LNX.3.95.981014192059.29439A-100000@fiddletrudge.dyn.ml.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 14 Oct 1998, Valerie Mates wrote:

> Hi -- I've been dabbling in PostgreSQL on and off for a few months now. At
> this point I can get it to do a number of neat things, but I've run into
> one that is a stumper.
>
> I'm looking for a way that my Perl program can look up the names of the
> tables in a database. Is there a way to do this? I've looked through the
> documentation on the PostgreSQL website, but didn't find any way to do
> this. It seems like there must be a query like "SELECT table_names FROM
> my_database" to do this, but if there is, I haven't found it yet.

select relname from pg_class where relname not like 'pg_%';

will give you all user-defined tables.

Simon.

>
> (My apologies if this has been discussed recently. I was on this mailing
> list for a while, but have been off it for a month or so.)
>
> Thanks for any help you can offer!
>
> -Valerie Mates
>
> -------------------------------------------------------------------
> Valerie Mates * Web Developer * http://www.valeriemates.com
> valerie(at)cyberspace(dot)org * (734) 995-6716
> -------------------------------------------------------------------
>
>
>

--
There are three kinds of people in this world: Those who can count,
and those who can't.

Simon Drabble mailto:madlather(at)syspac(dot)com
http://fiddletrudge.dyn.ml.org/
KreatAPayj -- KAP2/login.html
LizardCam -- LizardCam/LizCam.html

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 1998-10-14 23:43:06 Re: [GENERAL] How to find names of tables in a database?
Previous Message Gene Selkov Jr. 1998-10-14 20:57:08 Re: [GENERAL] How to find names of tables in a database?