X-Original-To: pgsql-admin-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id EE67B9FA506 for ; Mon, 17 Jul 2006 12:21:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 97583-08 for ; Mon, 17 Jul 2006 12:21:43 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from news.hub.org (news.hub.org [200.46.204.72]) by postgresql.org (Postfix) with ESMTP id 793809FA159 for ; Mon, 17 Jul 2006 12:21:44 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.13.1/8.13.1) with ESMTP id k6HFLhRH016410 for ; Mon, 17 Jul 2006 12:21:43 -0300 (ADT) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.13.1/8.13.1/Submit) id k6HF6jWn013478 for pgsql-admin@postgresql.org; Mon, 17 Jul 2006 12:06:45 -0300 (ADT) (envelope-from news) From: Chris Browne X-Newsgroups: pgsql.admin Subject: Re: Changing a database owner on postgres 7.3 Date: Mon, 17 Jul 2006 10:41:30 -0400 Organization: cbbrowne Computing Inc Lines: 37 Message-ID: <6064hwb8f9.fsf@dba2.int.libertyrms.com> References: <1153142760.2418.30.camel@laptop.gunduz.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.19 (linux) Cancel-Lock: sha1:D6+LEYHTa2wHmzJ1K5WmKaUdiVg= To: pgsql-admin@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/141 X-Sequence-Number: 22387 devrim@commandprompt.com (Devrim GUNDUZ) writes: > Hi, > > On Mon, 2006-07-17 at 12:33 +0000, Richard George wrote: >> I've run into trouble attempting to change the owner of a particular >> database. The offending line is - >> >> ALTER DATABASE test OWNER TO epg; > > There is no way to change ownership of a database with ALTER DATABASE in > 7.3.X . > >> Can someone suggest an alternative way of changing the owner of a >> database for 7.3? > > AFAIR there is no quick-and-easy way to do that for 7.3. I'd create a > new database with a new username, and I'd use the old database as the > template: > > CREATE DATABASE newdb WITH OWNER newuser TEMPLATE olddb; > > could work for you. I expect you could do the following: update pg_database set datdba = (select usesysid from pg_shadow where usename = 'epg') where datname = 'test'; Behind the scenes, that's probably what "ALTER DATABASE test OWNER TO epg;" actually does. -- output = reverse("gro.mca" "@" "enworbbc") http://www.ntlug.org/~cbbrowne/emacs.html "Catapultam habeo! Nisi pecuniam omnem mihi dabis, ad caput tuum saxum immane mittam !!" (I have a catapult! If you do not pay me the money you owe me, I will hit you with a big rock !!) -- Simon Gornall