From: | "Rudi" <rudi(at)oasis(dot)net(dot)au> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Database ownership |
Date: | 2002-02-05 22:49:05 |
Message-ID: | 006d01c1ae97$50994040$0c00a8c0@sun |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Michael,
Thank you kindly - exactly what I was after.
Cheers
Rudi.
----- Original Message -----
From: "Michael Lamertz" <mlamertz(at)media-support(dot)de>
To: "Rudi" <rudi(at)oasis(dot)net(dot)au>
Cc: <pgsql-sql(at)postgresql(dot)org>
Sent: Wednesday, February 06, 2002 1:22 AM
Subject: Re: [SQL] Database ownership
> On Tue, Feb 05, 2002 at 01:28:12PM +1000, Rudi wrote:
> > Hi,
> >
> > I've been searching without any joy so far so I thought I'd ask.
> > Can I change the ownership of a database after the database is created ?
> > Or do I need to drop the database and recreate it using the new database
owner account ?
>
> Nope,
>
> \d pg_database and pg_shadow. pg_database.datdba is a reference to
> pg_shadow.usesysid.
>
> Find out who's the owner:
> select a.datname, b.usename from pg_database a, pg_shadow b
> where a.datdba = b.usesysid;
>
> Update the owner:
> update pg_database
> set datdba = (select usesysid from pg_shadow where usename =
'SOMEUSERHERE')
> where datname = 'SOMEDATABASEHERE';
>
> That should do the trick.
>
> --
> Michael Lamertz |
mike(at)lamertz(dot)net
> Nordstr. 49 | http://www.lamertz.net -
http://www.perl-ronin.de
> 50733 Cologne | Priv: +49 221
445420
> Germany | Mobile: +49 171 6900
310
From | Date | Subject | |
---|---|---|---|
Next Message | Isabelle Brette | 2002-02-06 09:50:20 | Re: indexes |
Previous Message | Murray Prior Hobbs | 2002-02-05 22:37:19 | practical limitations to number of postgres user accounts |