Re: Get the tables names?

From: Dado Feigenblatt <dado(at)wildbrain(dot)com>
To: Magnus Landahl <magnus(dot)landahl(at)datessa(dot)se>, pgsql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Get the tables names?
Date: 2001-07-20 19:58:00
Message-ID: 3B588D48.80803@wildbrain.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Magnus Landahl wrote:

>Hi everybody!
>
>Is it possible to get the names of all tables in the database with a sql
>query??
>
>Best regards,
>
>Magnus
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: if posting/reading through Usenet, please send an appropriate
>subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
>message can get through to the mailing list cleanly
>
>
>
Not sure if this is the best way, but it works.
SELECT relname , relowner from pg_class where relkind = 'r';

The only thing is that this includes system tables.
So if you want to strip those you need to
SELECT relname , relowner FROM pg_class WHERE relkind = 'r' and
relowner != 26;

Is user postgres always 26? Maybe you have to find that out first.

--
Dado Feigenblatt Wild Brain, Inc.
Technical Director (415) 553-8000 x???
dado(at)wildbrain(dot)com San Francisco, CA.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2001-07-20 20:38:23 Re: nextval on insert by arbitrary sequence
Previous Message Dado Feigenblatt 2001-07-20 19:26:22 PLpgSQL