Re: Is renaming a database easy or dangerous

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Is renaming a database easy or dangerous
Дата
Msg-id 200303070358.h273w0X18299@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: Is renaming a database easy or dangerous  ("scott.marlowe" <scott.marlowe@ihs.com>)
Список 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 по дате отправления:

Предыдущее
От: Siva Kumar
Дата:
Сообщение: Re: foreign key constraint across databases
Следующее
От: Tom Lane
Дата:
Сообщение: Re: foreign key constraint across databases