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,



---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to