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

How to obtain the list of data table name only

From
"Sunny"
Date:
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

From
"Greg Patnude"
Date:
Here is the definition of a view I use to retrieve all of the tables and a
list of columns for tables that appear in the "public" schema ... I have
others that only retrieve a list of the table names and the views in the
public schema as well...

-- View: "vcat_pgcolumns"

-- DROP VIEW vcat_pgcolumns;

CREATE OR REPLACE VIEW vcat_pgcolumns AS
 SELECT psut.relid AS tbloid, pa.attnum AS colid, psut.relname AS tblname,
pa.attname AS colname
   FROM pg_stat_user_tables psut
   JOIN pg_attribute pa ON psut.relid = pa.attrelid
  WHERE psut.schemaname = 'public'::name AND pa.attstattarget = -1
  ORDER BY psut.relname, pa.attnum;

ALTER TABLE vcat_pgcolumns OWNER TO postgres;

"Sunny" <sunny076@yahoo.com> wrote in message
news:1121379847.886478.74380@f14g2000cwb.googlegroups.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
>