From: | darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain) |
---|---|
To: | Roberto Mello <rmello(at)cc(dot)usu(dot)edu> |
Cc: | Magnus Landahl <magnus(dot)landahl(at)datessa(dot)se>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Get the tables names? |
Date: | 2001-07-22 12:12:19 |
Message-ID: | 20010722121219.706F91A62@druid.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at){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.
From | Date | Subject | |
---|---|---|---|
Next Message | Gary Stainburn | 2001-07-23 09:18:08 | where'd the spaces come from |
Previous Message | Domingo Alvarez Duarte | 2001-07-22 10:14:46 | unique index on more than one field using functions |