Re: Equivalent to "use database" in postgre

From: Ozz Nixon <ozznixon(at)gmail(dot)com>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: javijava <welove(dot)e(dot)music(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Equivalent to "use database" in postgre
Date: 2010-06-25 15:01:47
Message-ID: 941275E3-9AC9-4296-BEF0-58ECECBEDF9B@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Jun 25, 2010, at 10:48 AM, Scott Marlowe wrote:

> On Fri, Jun 25, 2010 at 7:10 AM, javijava <welove(dot)e(dot)music(at)gmail(dot)com> wrote:
>>
>> Hi,
>>
>> i'm newby in postgre sql world.
>>
>> i need to know how to do a simple script that create a database,the y
>> select it (in other languajes using USE) and after create tables with this
>> database.
>>
>>
>> How can I say "use name_database" on postgre sql?
>
> You have to re-connect to use a different db in pgsql.

And to elaborate a little more, the true need for "use database" for MySQL is not truly needed in most other RDBMS solutions. In MySQL this allows you to use different database engines for different databases. It also allowed you to keep your project independent of others. Where more robust engines use schema and tablespace concepts to achieve this for you.

So, I would not implement a re-connect theory, I would suggest researching the database(s) you plan on supporting and seeing if there is a better way to leverage that engine for your needs. Which means, you need to know your needs - do you need data separation? Or, are you just used to sending the "use database" command?

Ozz

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2010-06-25 15:20:29 Re: Waarschuwing na pg_dumpall en restore
Previous Message Craig Ringer 2010-06-25 15:01:30 Re: Equivalent to "use database" in postgre