Re: Rename database?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Rename database?
Дата
Msg-id 2253.959700439@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Rename database?  (Philip Warner <pjw@rhyme.com.au>)
Список pgsql-hackers
Philip Warner <pjw@rhyme.com.au> writes:
> I have looked (briefly) through the general, sql, and hackers archives,and
> could not find anything the addressed the ability to rename a database.

Nope, we haven't got it.

As long as there are no backends running in the DB, I think it'd just
be a matter of renaming the subdirectory of data/base/ and updating the
pg_database row with the new name.  You could do that manually if you
are comfortable with assuming that no one is connected to the DB while
you do it.

> 1) is is there a place for a pg_rename utility? 

It could not be a standalone utility because it'd have no way to
interlock against running backends.  It'd have to be implemented as
an SQL statement and use the same interlock method that DROP DATABASE
does.

> 2) would it be a difficult thing to write?

Probably not too tough if you used DROP DATABASE as a model.

Bear in mind though that the whole issue might go away, depending on
what happens with the tablespace/schema/physical-file-name-conventions
discussions.  Might want to see how that plays out before expending much
work on it.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Applying TOAST to CURRENT
Следующее
От: The Hermit Hacker
Дата:
Сообщение: Re: Applying TOAST to CURRENT