pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Browne <cbbrowne@acm.org>
To: pgsql-admin@postgresql.org
Subject: Re: Changing a database owner on postgres 7.3
Date: Mon, 17 Jul 2006 10:41:30 -0400
Message-ID: <6064hwb8f9.fsf@dba2.int.libertyrms.com> (raw)
References: <BAY123-W19814FA014A611B13817F6C2620@phx.gbl>
	<1153142760.2418.30.camel@laptop.gunduz.org>

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 <simon@unique-id.com>



view thread (4+ messages)

Message-ID: <6064hwb8f9.fsf@dba2.int.libertyrms.com>
Permalink:  ../6064hwb8f9.fsf@dba2.int.libertyrms.com/
Also on:    postgresql.org/message-id/6064hwb8f9.fsf@dba2.int.libertyrms.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: cbbrowne@acm.org
  Subject: Re: Changing a database owner on postgres 7.3
  In-Reply-To: <6064hwb8f9.fsf@dba2.int.libertyrms.com>
  References: <BAY123-W19814FA014A611B13817F6C2620@phx.gbl> <1153142760.2418.30.camel@laptop.gunduz.org> <6064hwb8f9.fsf@dba2.int.libertyrms.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox