Re: 'moving' from one database to another

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: "mauricejea(at)numericable(dot)fr" <mauricejea(at)numericable(dot)fr>, "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: 'moving' from one database to another
Date: 2013-08-03 20:51:01
Message-ID: 2921.1375563061@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Kevin Grittner <kgrittn(at)ymail(dot)com> writes:
> Jean MAURICE <mauricejea(at)numericable(dot)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.

It's entirely likely that what you really want to approximate Foxpro with
is not multiple databases, but multiple schemas within a single database.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Jean MAURICE 2013-08-04 05:41:23 Re: 'moving' from one database to another
Previous Message Kevin Grittner 2013-08-03 19:20:20 Re: 'moving' from one database to another