Re: How to view the list of tables?

From: Mihail Nasedkin <m(dot)nasedkin(dot)perm(at)mail(dot)ru>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: How to view the list of tables?
Date: 2005-02-15 11:15:51
Message-ID: 15115500796.20050215161551@mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general 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(dot)nasedkin(dot)perm(at)mail(dot)ru

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2005-02-15 11:43:15 Re: Slony uninstall info/warning
Previous Message Geoffrey 2005-02-15 11:06:16 Re: /usr/sbin/useradd is needed by postgresql-server-8.0.1-PGDG

Browse pgsql-sql by date

  From Date Subject
Next Message KÖPFERL Robert 2005-02-15 12:40:54 Re: Constraint doesn't see a currently insertet record
Previous Message Shridhar Daithankar 2005-02-15 11:04:39 Re: How to view the list of tables?