Re: Any way to SELECT a list of table names?

From: "Chris Travers" <chris(at)travelamericas(dot)com>
To: <ken(at)perfect-image(dot)com>, "Eric Freeman" <ejf7(at)hotmail(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Any way to SELECT a list of table names?
Date: 2004-01-13 08:40:47
Message-ID: 015b01c3d9b1$42e7c470$54285e3d@winxp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From: "Ken Godee" <ken(at)perfect-image(dot)com>
> Not sure if this is what you're trying to do but.......
>
> "SELECT tablename FROM pg_tables where tablename not like 'pg_%'"
>
> Will get a list of tables in the db you're connected to.
>
You can do that, but if by any chance, the pg_catalog schema changes, you
may find your app broken. The pg_catalog schema is not really intended to
be a client interface, so if you go that way, you may want to wrap it in a
function :-)

Now, if you are using PostgreSQL 7.4, use this query instead:

select table_name, table_schema from information_schema.tables where
table_schema NOT IN ('pg_catalog', 'information_schema');

Best wishes,
Chris Travers

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John Sidney-Woollett 2004-01-13 08:50:05 Re: Drawbacks of using BYTEA for PK?
Previous Message Chris Travers 2004-01-13 08:30:39 Re: what we need to use postgresql in the enterprise