Re: changing ownership of db

From: "Benjamin Thelen (CCGIS)" <thelen(at)ccgis(dot)de>
To: Devrim GUNDUZ <devrim(at)gunduz(dot)org>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: changing ownership of db
Date: 2003-07-31 16:42:33
Message-ID: 3F2946F9.3080505@ccgis.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks very much!!
I had a user who was allowed to create dbs, but wasn't superuser...Now I
just have a superuser.

Benjamin

Devrim GUNDUZ wrote:
> Hi,
>
> On Tue, 29 Jul 2003, Benjamin Thelen (CCGIS) wrote:
>
>
>>I would like to change the ownership of a database. The only thing I
>>could find up to now, is that it is difficult, but I couldn't find any
>>detailed help.
>
>
> Connect to that database via psql.
>
> Then, first, update pg_database:
>
> UPDATE pg_database SET datdba=(SELECT usesysid FROM pg_shadow WHERE
> usename='new_owner') WHERE datname='db_name';
>
> If you also want to change the owner of the tables, update pg_class:
>
> UPDATE pg_class SET relowner=(SELECT usesysid FROM pg_shadow WHERE
> usename='new_owner') WHERE relname IN (SELECT relname from
> pg_class WHERE relname NOT LIKE 'pg_%');
>
> Maybe there is a shorter way, but I know this one.
>
> HTH,
>
> Regards,

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Andrew Sullivan 2003-07-31 16:58:20 Re: storage calculations
Previous Message Robert Treat 2003-07-31 14:07:16 Re: 7.3.4 RPM ready for RH 7.1 and RH 7.2