Re: Equivalent to "use database" in postgre

From: Tim Landscheidt <tim(at)tim-landscheidt(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Equivalent to "use database" in postgre
Date: 2010-06-25 15:00:26
Message-ID: m3mxujgnsl.fsf@passepartout.tim-landscheidt.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

javijava <welove(dot)e(dot)music(at)gmail(dot)com> wrote:

> 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 must specify the database to use on connect; if you want
to use psql for your script, you can use "\c name_database"
à la:

| CREATE DATABASE testdatabase;
| \c testdatabase
| CREATE TABLE testtable (testcolumn int);

Tim

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-06-25 15:00:44 Re: Equivalent to "use database" in postgre
Previous Message Tom Lane 2010-06-25 14:56:23 Re: Need Some Recent Information on the Differences between Postgres and MySql