From: Mihail Nasedkin <m.nasedkin.perm@mail.ru>
To: pgsql-sql@postgresql.org
Subject: Re: How to view the list of tables?
Date: Tue, 15 Feb 2005 16:15:51 +0500
Message-ID: <15115500796.20050215161551@mail.ru> (raw)
In-Reply-To: <E1D0zlJ-000AQR-00.danilov_konst-list-ru@f24.mail.ru>
References: <E1D0zlJ-000AQR-00.danilov_konst-list-ru@f24.mail.ru>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: m.nasedkin.perm@mail.ru
Subject: Re: How to view the list of tables?
In-Reply-To: <15115500796.20050215161551@mail.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox