Re: Any way to SELECT a list of table names? - Mailing list pgsql-general

From Chris Travers
Subject Re: Any way to SELECT a list of table names?
Date
Msg-id 015b01c3d9b1$42e7c470$54285e3d@winxp
Whole thread Raw
In response to Re: Any way to SELECT a list of table names?  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-general
From: "Ken Godee" <ken@perfect-image.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


pgsql-general by date:

Previous
From: "Chris Travers"
Date:
Subject: Re: what we need to use postgresql in the enterprise
Next
From: "John Sidney-Woollett"
Date:
Subject: Re: Drawbacks of using BYTEA for PK?