Re: How to view the list of tables? - Mailing list pgsql-sql

From Mihail Nasedkin
Subject Re: How to view the list of tables?
Date
Msg-id 15115500796.20050215161551@mail.ru
Whole thread Raw
In response to How to view the list of tables?  (Konstantin Danilov <danilov_konst@list.ru>)
List pgsql-sql
Hello, Konstantin.

You wrote February, 15 2005 г., 15:16:57:

KD> I need to view the list of tables in a database. In MySQL I
KD> can do it with the command "SHOW TABLES". What about PostgreSQL?

All tables:

select ...
from pg_catalog.pg_class
where c.relkind='r';


All tables of the public schema:

select ...
from pg_catalog.pg_class c join pg_catalog.pg_namespace n on c.relnamespace=n.oid
where c.relkind='r' and n.nspname='public';


KD> Can I also see somehow the datatypes of tables' fields?

select ...
from pg_catalog.pg_class c join pg_catalog.pg_attribute a on
c.oid=a.attrelid join pg_catalog.pg_type t on a.atttypid=t.oid

See also:

\d pg_class
\d pg_namespace
\d pg_attribute
\d pg_type

-- 
rgds,Mihail                          mailto:m.nasedkin.perm@mail.ru



pgsql-sql by date:

Previous
From: Dick Davies
Date:
Subject: Re: How to view the list of tables?
Next
From: KÖPFERL Robert
Date:
Subject: Re: Constraint doesn't see a currently insertet record