From: darcy@druid.net
To: Roberto Mello <rmello@cc.usu.edu>
Cc: Magnus Landahl <magnus.landahl@datessa.se>
Cc: pgsql-sql@postgresql.org
Subject: Re: Get the tables names?
Date: Sun, 22 Jul 2001 08:12:19 -0400 (EDT)
Message-ID: <20010722121219.706F91A62@druid.net> (raw)
In-Reply-To: <20010720122715.A5060@cc.usu.edu>
Thus spake Roberto Mello
> On Thu, Jul 19, 2001 at 11:04:40AM +0200, Magnus Landahl wrote:
> > Hi everybody!
> >
> > Is it possible to get the names of all tables in the database with a sql
> > query??
>
> SELECT tablename FROM pg_tables WHERE tablename NOT LIKE '%pg_%';
>
> The "NOT LIKE" part is to avoid getting the PostgreSQL internal tables
> in the output.
Further, to only get tables and not views, indexes, sequences, etc you
can do this.
SELECT tablename FROM pg_tables
WHERE relkind = 'r' AND tablename NOT LIKE '%pg_%';
--
D'Arcy J.M. Cain <darcy@{druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: darcy@druid.net, rmello@cc.usu.edu, magnus.landahl@datessa.se
Subject: Re: Get the tables names?
In-Reply-To: <20010722121219.706F91A62@druid.net>
* 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