fastmonkeys/stellar — pull request #40 by juanger (2014-10-21 01:22:41+00:00)
Title: Preserve Ownership of database and tables

This PR is just to start the discussion about this feature and should not be considered for merging.

In my use case, in a single project I have two databases and each one has to be accessed by different users, so I need a way to keep the original ownership of each database after restoring a snapshot.

In order to achieve this I create one new connection to each database and alter the owner of it and all of its objects with REASSIGN OWNED. It works for me currently but it has some bugs and has the postgres username hardcoded.

BUG: REASSIGN OWNED seems to change not only the objects in the current database, but all of the objects, including databases that are shared. This means that all the stellar master/slave databases will also change ownership. As long as the user that you specify in your connection url is a super user it is not a problem for this to work but it is far from desirable.