Re: Changing databases / schemas

From: adam_pgsql <adam_pgsql(at)witneyweb(dot)org>
To: Machiel Richards <machielr(at)rdc(dot)co(dot)za>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Changing databases / schemas
Date: 2010-02-22 12:14:18
Message-ID: F96A2A19-3522-493B-83EA-B5E0C912B81B@witneyweb.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> · In MySQL for example you can use “use <database>” and then change between databases which you want to access currently.
> o Is there something similar in Postgres or do you need to disconnect and reconnect to the next database everytime you want to change the current working DB?

To connect to a database from psql:
\c <database>

> · Once connected to a database , how can I see a list of schemas and in turn a list of tables that are currently available and also how do I see the table info (i.e describe in other dbms systems)

For a list of schemas (schemata?):
\dn

For a list of tables:
\dt <schema>.*

For a description of the table:
\d <schema>.<tablename>

For a full list of commands use:
\?

cheers

adam

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Machiel Richards 2010-02-22 12:16:13 Re: Changing databases / schemas
Previous Message Tino Wildenhain 2010-02-22 11:38:38 Re: What is unsecure postgres languages? How to disable them?