Re: Is renaming a database easy or dangerous - Mailing list pgsql-general

From Bruce Momjian
Subject Re: Is renaming a database easy or dangerous
Date
Msg-id 200303070358.h273w0X18299@candle.pha.pa.us
Whole thread Raw
In response to Re: Is renaming a database easy or dangerous  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-general
scott.marlowe wrote:
> On 27 Feb 2003, Hadley Willan wrote:
>
> > Hello,
> >    I'd like to rename one of my databases. Is it is simple as changing
> > the datname field in the pg_databases table?
> >
> > If so, is it done through ALTER database or a SQL update?
>
> The way I do it is:
>
> # createdb newdb
> # pg_dump olddb|psql -e newdb
> ... check to make sure it's all there working, then...
> # dropdb olddb

The coolest way I have seen it done is to do CREATE DATABASE with
TEMPLATE old_dbname, then drop the old database.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-general by date:

Previous
From: Siva Kumar
Date:
Subject: Re: foreign key constraint across databases
Next
From: Tom Lane
Date:
Subject: Re: foreign key constraint across databases