Re: Renaming a database

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Florian Weimer <Weimer(at)CERT(dot)Uni-Stuttgart(dot)DE>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Renaming a database
Date: 2002-07-01 17:14:10
Message-ID: 15049.1025543650@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Florian Weimer <Weimer(at)CERT(dot)Uni-Stuttgart(dot)DE> writes:
> Is there a way to rename an existing database, short of dumping and
> restoring it?

In 7.1 or later a quick UPDATE on pg_database.datname should do it,
I believe.

It might be a bad idea to do it while there are any connections to
the target database --- I know that backends remember the name of the
DB they are connected to, but I forget whether it's actually used for
anything significant.

Also, vacuuming pg_database after committing the UPDATE might be
necessary, depending on just which version you are running.

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tim Ellis 2002-07-01 17:47:41 Re: tedia2sql 0.77 (Dia-->SQL DDL Tool) Released
Previous Message Florian Weimer 2002-07-01 15:41:59 Renaming a database