pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robins Tharakan <tharakan@gmail.com>
To: Mag Gam <magawake@gmail.com>
To: Nuwan Liyanage <alnuwan2@yahoo.com>
Cc: Guillaume Lelarge <guillaume@lelarge.info>
Cc: pgsql-admin@postgresql.org
Subject: Re: rename database
Date: Thu, 7 Feb 2008 09:36:19 +0530
Message-ID: <36af4bed0802062006p2d4cda12gcb1ff7de49053dd6@mail.gmail.com> (raw)
In-Reply-To: <1cbd6f830802061952h49210b36w21d66da6f33aa925@mail.gmail.com>
References: <465222.91055.qm@web46015.mail.sp1.yahoo.com>
	<47AA35C5.6080600@lelarge.info>
	<1cbd6f830802061952h49210b36w21d66da6f33aa925@mail.gmail.com>

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
>

view thread (6+ messages)

Message-ID: <36af4bed0802062006p2d4cda12gcb1ff7de49053dd6@mail.gmail.com>
Permalink:  ../36af4bed0802062006p2d4cda12gcb1ff7de49053dd6@mail.gmail.com/
Also on:    postgresql.org/message-id/36af4bed0802062006p2d4cda12gcb1ff7de49053dd6@mail.gmail.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-admin@postgresql.org
  Cc: tharakan@gmail.com, magawake@gmail.com, alnuwan2@yahoo.com, guillaume@lelarge.info
  Subject: Re: rename database
  In-Reply-To: <36af4bed0802062006p2d4cda12gcb1ff7de49053dd6@mail.gmail.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