Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id DA64B475B04 for ; Mon, 1 Jul 2002 13:14:16 -0400 (EDT) Mailbox-Line: From tgl@sss.pgh.pa.us Mon Jul 1 13:14:16 2002 Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 0BF03475A5A for ; Mon, 1 Jul 2002 13:14:13 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g61HEA215052; Mon, 1 Jul 2002 13:14:10 -0400 (EDT) To: Florian Weimer Cc: pgsql-admin@postgresql.org Subject: Re: Renaming a database In-reply-to: <871yancv5k.fsf@CERT.Uni-Stuttgart.DE> References: <871yancv5k.fsf@CERT.Uni-Stuttgart.DE> Comments: In-reply-to Florian Weimer message dated "Mon, 01 Jul 2002 17:41:59 +0200" Date: Mon, 01 Jul 2002 13:14:10 -0400 Message-ID: <15049.1025543650@sss.pgh.pa.us> From: Tom Lane X-Spam-Status: No, hits=-5.3 required=5.0 tests=IN_REP_TO,X_NOT_PRESENT version=2.30 X-Spam-Level: X-Archive-Number: 200207/4 X-Sequence-Number: 4691 Florian Weimer writes: > Is there a way to rename an existing database, short of dumping and > restoring it? In 7.1 or later a quick UPDATE on pg_database.datname should do it, I believe. It might be a bad idea to do it while there are any connections to the target database --- I know that backends remember the name of the DB they are connected to, but I forget whether it's actually used for anything significant. Also, vacuuming pg_database after committing the UPDATE might be necessary, depending on just which version you are running. regards, tom lane