Re: refactoring a database owner without "reassign owned" - Mailing list pgsql-general

From Vincent Veyron
Subject Re: refactoring a database owner without "reassign owned"
Date
Msg-id 1368461588.2563.49.camel@asus-1001PX.home
Whole thread Raw
In response to refactoring a database owner without "reassign owned"  (Jeff Janes <jeff.janes@gmail.com>)
Responses Re: refactoring a database owner without "reassign owned"
List pgsql-general
Le mercredi 08 mai 2013 à 14:11 -0700, Jeff Janes a écrit :
> 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?
>

with sed on Linux/Unix, you could do this :

pg_dump -f mess.out mess

sed -i 's/OWNER TO postgres/OWNER TO proper_username/' mess.out

createdb clean

psql -f mess.out clean

You'll also want to modify the REVOKE ALL ON SCHEMA/GRANT ALL ON SCHEMA
that are at the end of the dump file

--
Salutations, Vincent Veyron
http://marica.fr/site/demonstration
Logiciel de gestion des contentieux juridiques et des sinistres d'assurance



pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Vacuum problem
Next
From: "Sahagian, David"
Date:
Subject: replanning Prepared Statements ?