pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
Database ownership 2+ messages / 1 participants [nested] [flat]
* Database ownership @ 2002-02-05 03:28 Rudi <rudi@oasis.net.au> 0 siblings, 1 reply; 2+ messages in thread From: Rudi @ 2002-02-05 03:28 UTC (permalink / raw) To: pgsql-sql 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 ? Thanks kindly Rudi Starcevic ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Database ownership @ 2002-02-05 22:49 Rudi <rudi@oasis.net.au> parent: Rudi <rudi@oasis.net.au> 0 siblings, 0 replies; 2+ messages in thread From: Rudi @ 2002-02-05 22:49 UTC (permalink / raw) To: pgsql-sql Michael, Thank you kindly - exactly what I was after. Cheers Rudi. ----- Original Message ----- From: "Michael Lamertz" <mlamertz@media-support.de> To: "Rudi" <rudi@oasis.net.au> Cc: <pgsql-sql@postgresql.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@lamertz.net > Nordstr. 49 | http://www.lamertz.net - http://www.perl-ronin.de > 50733 Cologne | Priv: +49 221 445420 > Germany | Mobile: +49 171 6900 310 ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2002-02-05 22:49 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2002-02-05 03:28 Database ownership Rudi <rudi@oasis.net.au> 2002-02-05 22:49 ` Rudi <rudi@oasis.net.au>
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