Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 319399FB943 for ; Mon, 26 Feb 2007 13:04:40 -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 56972-04 for ; Mon, 26 Feb 2007 13:04:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by postgresql.org (Postfix) with ESMTP id 4A76A9FB4E8 for ; Mon, 26 Feb 2007 13:04:35 -0400 (AST) Received: from server3.office.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 6359E76A7A; Mon, 26 Feb 2007 16:58:41 +0000 (GMT) Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id 6B9AE274090; Mon, 26 Feb 2007 16:58:40 +0000 (GMT) Message-ID: <45E311C0.5090909@archonet.com> Date: Mon, 26 Feb 2007 16:58:40 +0000 From: Richard Huxton User-Agent: IceDove 1.5.0.9 (X11/20061220) MIME-Version: 1.0 To: Rommel the iCeMAn Cc: pgsql-sql@postgresql.org Subject: Re: Change Default Database References: <008401c759c6$81bef2c0$b364a8c0@theport.com> In-Reply-To: <008401c759c6$81bef2c0$b364a8c0@theport.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.216 tagged_above=0 required=5 tests=AWL, BAYES_50, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200702/266 X-Sequence-Number: 27600 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