pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: How to view the list of tables?
5+ messages / 4 participants
[nested] [flat]

* Re: How to view the list of tables?
@ 2005-02-15 10:37 ` Dick Davies <rasputnik@hellooperator.net>
  2005-02-15 10:49   ` Re: How to view the list of tables? Dick Davies <rasputnik@hellooperator.net>
  3 siblings, 1 reply; 5+ messages in thread

From: Dick Davies @ 2005-02-15 10:37 UTC (permalink / raw)
  To: Konstantin Danilov <danilov_konst@list.ru>; +Cc: pgsql-sql

* Konstantin Danilov <danilov_konst@list.ru> [0222 10:22]:
> 
> Hello, list!
> I need to view the list of tables in a database. In MySQL I can do it with the command "SHOW TABLES". What about PostgreSQL?
> Can I also see somehow the datatypes of tables' fields?

\dt in psjl lists tables

( \d gives you things like sequences as well)

\d tablename shows its layout.


-- 
'Tempers are wearing thin. Let's hope some robot doesn't kill everybody.'
		-- Bender
Rasputin :: Jack of All Trades - Master of Nuns



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: How to view the list of tables?
  2005-02-15 10:37 ` Re: How to view the list of tables? Dick Davies <rasputnik@hellooperator.net>
@ 2005-02-15 10:49   ` Dick Davies <rasputnik@hellooperator.net>
  0 siblings, 0 replies; 5+ messages in thread

From: Dick Davies @ 2005-02-15 10:49 UTC (permalink / raw)
  To: danilov_konst@list.ru; +Cc: pgsql-sql

* Dick Davies <rasputnik@hellooperator.net> [0241 10:41]:
> * Konstantin Danilov <danilov_konst@list.ru> [0222 10:22]:
> > 
> > Hello, list!
> > I need to view the list of tables in a database. In MySQL I can do it with the command "SHOW TABLES". What about PostgreSQL?
> > Can I also see somehow the datatypes of tables' fields?
> 
> \dt in psjl lists tables

that should be 'psql', obviously..... :)
 
-- 
'Tempers are wearing thin. Let's hope some robot doesn't kill everybody.'
		-- Bender
Rasputin :: Jack of All Trades - Master of Nuns



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: How to view the list of tables?
@ 2005-02-15 10:47 ` Richard Huxton <dev@archonet.com>
  3 siblings, 0 replies; 5+ messages in thread

From: Richard Huxton @ 2005-02-15 10:47 UTC (permalink / raw)
  To: Konstantin Danilov <danilov_konst@list.ru>; +Cc: pgsql-sql; pgsql-general@postgresql.org

Konstantin Danilov wrote:
> Hello, list!
> I need to view the list of tables in a database. In MySQL I can do it with the command "SHOW TABLES". What about PostgreSQL?
> Can I also see somehow the datatypes of tables' fields?
> Konstantin

"man psql" will show you details of how to operate the psql application, 
or when in it try "\?" and "\h" to get help. We also now support the 
SQL-standard "information schema".

You'll also find the manuals have this information - available with your 
installation and also online at http://www.postgresql.org/docs/

HTH
-- 
   Richard Huxton
   Archonet Ltd



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: How to view the list of tables?
@ 2005-02-15 11:04 ` Shridhar Daithankar <ghodechhap@ghodechhap.net>
  3 siblings, 0 replies; 5+ messages in thread

From: Shridhar Daithankar @ 2005-02-15 11:04 UTC (permalink / raw)
  To: Konstantin Danilov <danilov_konst@list.ru>; +Cc: pgsql-sql; pgsql-general@postgresql.org

On Tuesday 15 Feb 2005 3:46 pm, Konstantin Danilov wrote:
> Hello, list!
> I need to view the list of tables in a database. In MySQL I can do it with
> the command "SHOW TABLES". What about PostgreSQL? Can I also see somehow
> the datatypes of tables' fields?

In psql, you can try '\dt' and '\d table name'. Type \? for more commands..

 Shridhar



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: How to view the list of tables?
@ 2005-02-15 11:15 ` Mihail Nasedkin <m.nasedkin.perm@mail.ru>
  3 siblings, 0 replies; 5+ messages in thread

From: Mihail Nasedkin @ 2005-02-15 11:15 UTC (permalink / raw)
  To: 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




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2005-02-15 11:15 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-02-15 10:37 ` Dick Davies <rasputnik@hellooperator.net>
2005-02-15 10:49   ` Dick Davies <rasputnik@hellooperator.net>
2005-02-15 10:47 ` Richard Huxton <dev@archonet.com>
2005-02-15 11:04 ` Shridhar Daithankar <ghodechhap@ghodechhap.net>
2005-02-15 11:15 ` Mihail Nasedkin <m.nasedkin.perm@mail.ru>

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