Re: 'moving' from one database to another - Mailing list pgsql-novice

From Kevin Grittner
Subject Re: 'moving' from one database to another
Date
Msg-id 1375557620.74674.YahooMailNeo@web162905.mail.bf1.yahoo.com
Whole thread Raw
In response to 'moving' from one database to another  (Jean MAURICE <mauricejea@numericable.fr>)
Responses Re: 'moving' from one database to another
List pgsql-novice
Jean MAURICE <mauricejea@numericable.fr> wrote:

> I connect to the database 'postgres'. I can then test if the
> database I want is already built and I build it if not.
>
> But once it is built, can I 'move' from the default database to
> my new database with a command OR must I disconnect from postgres
> and reconnect to my new database ? In Visual Foxpro, we have a
> command "SET DATABASE TO mydatabase" and it is exactly what I
> want to do !

In PostgreSQL a connection is to a particular database.  To use a
different database you must establish a new connection.  The psql
client software provides an easy way to do that with \c, but behind
the scenes that closes the existing connection and opens a new one.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-novice by date:

Previous
From: Jean MAURICE
Date:
Subject: 'moving' from one database to another
Next
From: Tom Lane
Date:
Subject: Re: 'moving' from one database to another