Обсуждение: Change the name of the database

Поиск
Список
Период
Сортировка

Change the name of the database

От
Sylvain Brohée
Дата:
Could somebody help me?
I'm trying to change the name of my psql database.
Does it exist any command to do this.

Thanks a lot for your help,

Sylvain Brohée
Free University of Brussels


Re: Change the name of the database

От
Chris Mair
Дата:
> Could somebody help me?
> I'm trying to change the name of my psql database.
> Does it exist any command to do this.

Sure,
just issue this command:

  alter database old_db_name rename to new_db_name;

Bye,
Chris.




Re: [despammed] Change the name of the database

От
Andreas Kretschmer
Дата:
am  17.01.2005, um 12:06:45 +0100 mailte Sylvain Brohée folgendes:
> Could somebody help me?
> I'm trying to change the name of my psql database.
> Does it exist any command to do this.

Create a dump, create the new db, and play the dump in the new db.


Andreas
--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47212,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    ===

Re: Change the name of the database

От
Tom Lane
Дата:
Chris Mair <list@1006.org> writes:
>> I'm trying to change the name of my psql database.
>> Does it exist any command to do this.

> just issue this command:
>   alter database old_db_name rename to new_db_name;

Note that this command exists only since PG 7.4.  In earlier releases,
you can fake it by executing a manual UPDATE on pg_database.  (Beware
that you need to do a CHECKPOINT afterware to be sure that newly
connecting backends will see the updated name.)

            regards, tom lane