Обсуждение: How to obtain the list of data table name only

Поиск
Список
Период
Сортировка

How to obtain the list of data table name only

От
sunny076@yahoo.com
Дата:
Hi,

I am wondering if anyone can tell me how I can obtain only the list of
data table in postgresql without function and other ancillary tables. I
hope that I can add a tag that can filter only data table.

I am using the following SQL Statement:

"SELECT TABLE_NAME, TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES"

I would appreciate if anyone can enligten me on how this can be
achieve. 

Sunny



Re: How to obtain the list of data table name only

От
Richard Huxton
Дата:
sunny076@yahoo.com wrote:
> Hi,
> 
> I am wondering if anyone can tell me how I can obtain only the list of
> data table in postgresql without function and other ancillary tables. I
> hope that I can add a tag that can filter only data table.
> 
> I am using the following SQL Statement:
> 
> "SELECT TABLE_NAME, TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES"

Something like this perhaps?

SELECT * FROM  information_schema.tables
WHERE table_schema='public' AND table_type='BASE TABLE';

Of course, you'll probably want to allow for multiple schemas.

--   Richard Huxton  Archonet Ltd


Re: How to obtain the list of data table name only

От
Neil Dugan
Дата:
On Thu, 2005-07-14 at 15:24 -0700, sunny076@yahoo.com wrote:
> Hi,
> 
> I am wondering if anyone can tell me how I can obtain only the list of
> data table in postgresql without function and other ancillary tables. I
> hope that I can add a tag that can filter only data table.
> 
> I am using the following SQL Statement:
> 
> "SELECT TABLE_NAME, TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES"
> 
> I would appreciate if anyone can enligten me on how this can be
> achieve. 
> 
> Sunny

I am not sure what you mean but one way to find out what tables there
are is to use the 'pg_tables' view.

select tablename from pg_tables;

Regards Neil.