refactoring a database owner without "reassign owned"

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: refactoring a database owner without "reassign owned"
Date: 2013-05-08 21:11:13
Message-ID: CAMkU=1zz66h_NfnRPZdyWO=kaUeL6Vj5yJ9WcgMCZTNSoPhbwQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Let's say you have a database which is owned (as well as all the contents
within it) by the postgres internal user.

Having created or inherited a mess, how do you fix it?

database1=# REASSIGN OWNED BY postgres TO foo ;

ERROR: cannot reassign ownership of objects owned by role postgres because
they are required by the database system

Is there some way simpler than going through every object of every type and
doing an "ALTER <TYPE> <OBJECTNAME> OWNER to..." ?

This is on 9.2.4, but I think it applies to all versions.

Cheers,

Jeff

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2013-05-08 21:35:02 Re: Does it make sense to break a large query into separate functions?
Previous Message Ray Stell 2013-05-08 21:05:05 pg_upgrade -u