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

From: "Greg Patnude" <gpatnude(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to obtain the list of data table name only
Date: 2005-07-15 15:15:27
Message-ID: db8jh5$2382$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


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(at)yahoo(dot)com> wrote in message
news:1121379847(dot)886478(dot)74380(at)f14g2000cwb(dot)googlegroups(dot)com(dot)(dot)(dot)
> 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
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Patnude 2005-07-15 15:26:14 Re: Transparent encryption in PostgreSQL?
Previous Message Scott cox 2005-07-15 15:08:24 (Win32 Postgres) Slow to Connect first - OK afterwards