Re: Renaming a database - Mailing list pgsql-admin

From Tom Lane
Subject Re: Renaming a database
Date
Msg-id 15049.1025543650@sss.pgh.pa.us
Whole thread Raw
In response to Renaming a database  (Florian Weimer <Weimer@CERT.Uni-Stuttgart.DE>)
List pgsql-admin
Florian Weimer <Weimer@CERT.Uni-Stuttgart.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



pgsql-admin by date:

Previous
From: Florian Weimer
Date:
Subject: Renaming a database
Next
From: Tim Ellis
Date:
Subject: Re: tedia2sql 0.77 (Dia-->SQL DDL Tool) Released