Re: refactoring a database owner without "reassign owned"

Поиск
Список
Период
Сортировка
От Vincent Veyron
Тема Re: refactoring a database owner without "reassign owned"
Дата
Msg-id 1368461588.2563.49.camel@asus-1001PX.home
обсуждение исходный текст
Ответ на refactoring a database owner without "reassign owned"  (Jeff Janes <jeff.janes@gmail.com>)
Ответы Re: refactoring a database owner without "reassign owned"  (Jeff Janes <jeff.janes@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: Vacuum problem
Следующее
От: "Sahagian, David"
Дата:
Сообщение: replanning Prepared Statements ?