pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joel Burton <jburton@scw.org>
To: Dado Feigenblatt <dado@wildbrain.com>
Cc: Magnus Landahl <magnus.landahl@datessa.se>
Cc: pgsql <pgsql-sql@postgresql.org>
Subject: Re: Get the tables names?
Date: Fri, 20 Jul 2001 16:43:50 -0400 (EDT)
Message-ID: <Pine.LNX.4.21.0107201642270.3206-100000@olympus.scw.org> (raw)
In-Reply-To: <3B588D48.80803@wildbrain.com>

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




view thread (10+ messages)  latest in thread

Message-ID: <Pine.LNX.4.21.0107201642270.3206-100000@olympus.scw.org>
Permalink:  ../Pine.LNX.4.21.0107201642270.3206-100000@olympus.scw.org/
Also on:    postgresql.org/message-id/Pine.LNX.4.21.0107201642270.3206-100000@olympus.scw.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: jburton@scw.org, dado@wildbrain.com, magnus.landahl@datessa.se
  Subject: Re: Get the tables names?
  In-Reply-To: <Pine.LNX.4.21.0107201642270.3206-100000@olympus.scw.org>
  References: <3B588D48.80803@wildbrain.com> <Pine.LNX.4.21.0107201642270.3206-100000@olympus.scw.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox