Re: Set new owner on cloned database

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
Cc: pgsql-general(at)postgresql(dot)org, byrnejb(at)harte-lyne(dot)ca
Subject: Re: Set new owner on cloned database
Date: 2010-12-08 22:46:43
Message-ID: 4D000AD3.7080006@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Le 08/12/2010 22:41, Ivan Sergio Borgonovo a écrit :
> On Wed, 8 Dec 2010 13:40:29 -0500 (EST)
> "James B. Byrne" <byrnejb(at)harte-lyne(dot)ca> wrote:
>
>> I am testing a Rails deployment and wish to copy a database
>> assigning it an new owner. I have tried this:
>>
>> createdb --owner=hll_theheart_db_devl
>> --template=hll_th_deploytest_prod hll_theheart_devl
>>
>> While this indeed sets the database owner to hll_theheart_db_devl
>> everything else, schema, tables whatever, remains owned by the
>> original owner. Is there no way to change the owner everywhere in
>> the cloned database using cretedb?

No, you can't. --owner changes only the owner of the database.

>> Or am I constrained to do a
>> dump all and restore?
>
> http://www.mail-archive.com/pgsql-hackers(at)postgresql(dot)org/msg51048.html
> http://www.mail-archive.com/pgsql-hackers(at)postgresql(dot)org/msg51047.html
>
> I'm not sure if there has been any progress in newer postgres to
> support easier change of owner.
> I'm not aware of any more current better solution.
>

You should try REASSIGN OWNED BY. See
http://www.postgresql.org/docs/9.0/interactive/sql-reassign-owned.html

--
Guillaume
http://www.postgresql.fr
http://dalibo.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Toby Corkindale 2010-12-09 01:54:46 pl/perl interpreter instance(s) - how long does it persist?
Previous Message Reuven M. Lerner 2010-12-08 22:32:00 Re: Hanging with pg_restore and large objects