I have looked (briefly) through the general, sql, and hackers archives,and
could not find anything the addressed the ability to rename a database.
Most of the posts resorted to using pg_dump to rebuild the database under a
I appreciate that (AFAIK) SQL does not have 'alter schema rename', but it
is something I would find very useful: I have a web site that is 99.9%
read-only, where bulk updates are sent periodically and can take a lot of
time to run, so what I do is apply the changes (or rebuild the db) under
another name. After this is done, I would like to rename the current DB,
and put the new one in it's place. Currently this is fine with the 100,000
or so records it contains, but the projections are for 5M+ records within
I strongly suspect that renaming the directory will not work, and besides,
I have a strong aversion to making structural changes to files that are
logically part of the database.
So the questions are:
1) is is there a place for a pg_rename utility?
2) would it be a difficult thing to write?
3) is this better handled by psql.
I suspect the answer to (3) is 'NO', since moving databases around seems to
be something best done without a backend attached.
Any and all (polite) comments welcome.
P.S. Before anybody suggests it, I currently build the new db elsewhere,
then do a pg_dump, delete the current DB, and load from the dump file. This
is fine for the relatively small amount of data currently in the db.
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.C.N. 008 659 498) | /(@) ______---_
Tel: +61-03-5367 7422 | _________ \
Fax: +61-03-5367 7430 | ___________ |
Http://www.rhyme.com.au | / \|
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/
pgsql-hackers by date
|Next:||From: Zeugswetter Andreas SB||Date: 2000-05-30 11:39:17|
|Subject: AW: Proposal for enhancements of privilege system|
|Previous:||From: Andrew McMillan||Date: 2000-05-30 11:23:44|
|Subject: Using BOOL in indexes|