Re: rename database

From: "Robins Tharakan" <tharakan(at)gmail(dot)com>
To: "Mag Gam" <magawake(at)gmail(dot)com>, "Nuwan Liyanage" <alnuwan2(at)yahoo(dot)com>
Cc: "Guillaume Lelarge" <guillaume(at)lelarge(dot)info>, pgsql-admin(at)postgresql(dot)org
Subject: Re: rename database
Date: 2008-02-07 04:06:19
Message-ID: 36af4bed0802062006p2d4cda12gcb1ff7de49053dd6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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(at)gmail(dot)com>
Date: Feb 7, 2008 9:22 AM
Subject: Re: [ADMIN] rename database
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
Cc: Nuwan Liyanage <alnuwan2(at)yahoo(dot)com>, pgsql-admin(at)postgresql(dot)org

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

On Feb 6, 2008 5:33 PM, Guillaume Lelarge <guillaume(at)lelarge(dot)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
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Hans Guijt 2008-02-07 08:58:17 Re: Where to find information on the new HOT tables?
Previous Message Mag Gam 2008-02-07 03:52:51 Re: rename database