pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Rommel the iCeMAn <icecrew@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Change Default Database
Date: Mon, 26 Feb 2007 16:58:40 +0000
Message-ID: <45E311C0.5090909@archonet.com> (raw)
In-Reply-To: <008401c759c6$81bef2c0$b364a8c0@theport.com>
References: <008401c759c6$81bef2c0$b364a8c0@theport.com>

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



view thread (10+ messages)  latest in thread

Message-ID: <45E311C0.5090909@archonet.com>
Permalink:  ../45E311C0.5090909@archonet.com/
Also on:    postgresql.org/message-id/45E311C0.5090909@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, icecrew@gmail.com
  Subject: Re: Change Default Database
  In-Reply-To: <45E311C0.5090909@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox