Re: Get the tables names? - Mailing list pgsql-sql

From Joel Burton
Subject Re: Get the tables names?
Date
Msg-id Pine.LNX.4.21.0107201642270.3206-100000@olympus.scw.org
Whole thread Raw
In response to Re: Get the tables names?  (Dado Feigenblatt <dado@wildbrain.com>)
List pgsql-sql
On Fri, 20 Jul 2001, Dado Feigenblatt wrote:

> 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@postgresql.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.

system tables all ~ '^pg', which is probably a better check than
user=postgresql.


hth,
-- 
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington



pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: nextval on insert by arbitrary sequence
Next
From: "Josh Berkus"
Date:
Subject: Re: TODO List