Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 162FC2E2D82 for ; Thu, 7 Feb 2008 00:06:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 94125-05 for ; Thu, 7 Feb 2008 00:06:21 -0400 (AST) Received: from hu-out-0506.google.com (hu-out-0506.google.com [72.14.214.239]) by postgresql.org (Postfix) with ESMTP id 503862E0144 for ; Thu, 7 Feb 2008 00:06:21 -0400 (AST) Received: by hu-out-0506.google.com with SMTP id 22so5532586hug.23 for ; Wed, 06 Feb 2008 20:06:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=Tkarn4rZPWjd0fCxmB0qTFiMLVG/sOrGRT7F8BJ+Ikg=; b=MsDH+mQFtIG3VzvNA20u2EQqEtwBM8FB5ILAPWXHMEjNBUcr+c+b8sY7/5jJ99IkNECpgkoPFGnTDF6+gc1hq0yAYvI968BibTAYMChAhE5geUv6R+Y9YEGB7FQufzmVo8Q0AAslbiGmt+o1wmWI5gPmTon+PvitLWwwDchhKyk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=b67sp8bO62NkR2ErjwXu7j+4U7eNZdyRxjt3uGiWHsWLyK5fYA0UXQjVwySKER5z7agsD5p5VPHscI+GT84r+JMrNXBDnOfyFOWbneZKj+fqFkpeZGd9Ss1VvxTa4+hJh4Hc8Ul/WRlD7Q1LOfKBXT2+c/ogiPN0uPiW9w9uP/4= Received: by 10.82.184.2 with SMTP id h2mr19558545buf.22.1202357179672; Wed, 06 Feb 2008 20:06:19 -0800 (PST) Received: by 10.82.113.9 with HTTP; Wed, 6 Feb 2008 20:06:19 -0800 (PST) Message-ID: <36af4bed0802062006p2d4cda12gcb1ff7de49053dd6@mail.gmail.com> Date: Thu, 7 Feb 2008 09:36:19 +0530 From: "Robins Tharakan" To: "Mag Gam" , "Nuwan Liyanage" Subject: Re: rename database Cc: "Guillaume Lelarge" , pgsql-admin@postgresql.org In-Reply-To: <1cbd6f830802061952h49210b36w21d66da6f33aa925@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_13700_2746113.1202357179656" References: <465222.91055.qm@web46015.mail.sp1.yahoo.com> <47AA35C5.6080600@lelarge.info> <1cbd6f830802061952h49210b36w21d66da6f33aa925@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/72 X-Sequence-Number: 28146 ------=_Part_13700_2746113.1202357179656 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Rightly as Guillaume said, tampering with a system table isn't a very good idea. This is what he suggested: 1. Lets say you are connected to Database A 2. Reconnect to Database B on the server (this database B could be any database other than A on the server) 3. Rename database A to C 4. Reconnect to C Without step 2, step 3 would always spew the error about unable to rename the 'current database'. *Robins* ---------- Forwarded message ---------- From: Mag Gam Date: Feb 7, 2008 9:22 AM Subject: Re: [ADMIN] rename database To: Guillaume Lelarge Cc: Nuwan Liyanage , pgsql-admin@postgresql.org what's the right way to rename a database then? On Feb 6, 2008 5:33 PM, Guillaume Lelarge wrote: > Nuwan Liyanage wrote: > > Ok I think I got it. I just went ahead and updated the pg_database table > > and it works.. > > > > A better way is to connect to another database (template1 for exemple, > but you would better use another one) and fire your statement there. > > Updating system table can be dangerous. > > > -- > Guillaume. > http://www.postgresqlfr.org > http://dalibo.com > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > ------=_Part_13700_2746113.1202357179656 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
Rightly as Guillaume said, tampering with a system table isn't a very good idea.

This is what he suggested:
1. Lets say you are connected to Database A
2. Reconnect to Database B on the server (this database B could be any database other than A on the server)
3. Rename database A to C
4. Reconnect to C

Without step 2, step 3 would always spew the error about unable to rename the 'current database'.

Robins

---------- Forwarded message ----------
From: Mag Gam <magawake@gmail.com>
Date: Feb 7, 2008 9:22 AM
Subject: Re: [ADMIN] rename database
To: Guillaume Lelarge <guillaume@lelarge.info>
Cc: Nuwan Liyanage <alnuwan2@yahoo.com>, pgsql-admin@postgresql.org


what's the right way to rename a database then?




On Feb 6, 2008 5:33 PM, Guillaume Lelarge <guillaume@lelarge.info> wrote:
Nuwan Liyanage wrote:
> Ok I think I got it. I just went ahead and updated the pg_database table
> and it works..
>

A better way is to connect to another database (template1 for exemple,
but you would better use another one) and fire your statement there.

Updating system table can be dangerous.


--
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq


------=_Part_13700_2746113.1202357179656--