Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 959489FB368 for ; Mon, 26 Feb 2007 15:40:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 01851-09 for ; Mon, 26 Feb 2007 15:40:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id CD7E39FAA6E for ; Mon, 26 Feb 2007 15:40:43 -0400 (AST) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Mon, 26 Feb 2007 19:40:42 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 26 Feb 2007 13:40:42 -0600 Subject: Re: Change Default Database From: Scott Marlowe To: Rommel the iCeMAn Cc: pgsql-sql@postgresql.org In-Reply-To: <008401c759c6$81bef2c0$b364a8c0@theport.com> References: <008401c759c6$81bef2c0$b364a8c0@theport.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1172518842.20651.19.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Mon, 26 Feb 2007 13:40:42 -0600 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/271 X-Sequence-Number: 27605 On Mon, 2007-02-26 at 10:52, 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? A couple of points: 1: PLEASE don't post html email, especially with an annoying background that makes it harder to read your message. 2: What kind of script is this? sql? bash? PHP? perl? If you post the script, we can probably help you out a bit.