Re: Equivalent to "use database" in postgre - Mailing list pgsql-general

From Tim Landscheidt
Subject Re: Equivalent to "use database" in postgre
Date
Msg-id m3mxujgnsl.fsf@passepartout.tim-landscheidt.de
Whole thread Raw
In response to Equivalent to "use database" in postgre  (javijava <welove.e.music@gmail.com>)
List pgsql-general
javijava <welove.e.music@gmail.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

pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Equivalent to "use database" in postgre
Next
From: Tom Lane
Date:
Subject: Re: Equivalent to "use database" in postgre