Re: Change Default Database

From: Richard Huxton <dev(at)archonet(dot)com>
To: Rommel the iCeMAn <icecrew(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Change Default Database
Date: 2007-02-26 16:58:40
Message-ID: 45E311C0.5090909@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Rommel the iCeMAn wrote:
> Hi list,
>
> I wrote a database creation script that begins with commands to drop the
> existing database (if it exists) and create it from scratch. These commands
> execute fine, the problem is that all subsequent commands are executed on
> the default database 'postgres'. What command can I use to set the default
> database to my newly created database (for the duration of the script)? SQL
> Server has a 'USE [dbname]' command, is there an equivalent command in
> PostgreSQL?

See "man psql" (or the client applications section of the manuals) for
details on the backslash commands. \c will be what you're after.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rodrigo De León 2007-02-26 17:09:24 Re: Change Default Database
Previous Message Rommel the iCeMAn 2007-02-26 16:52:19 Change Default Database