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:[EMAIL PROTECTED]


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to