Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Postgres - Create Superuser For vagrant role #422

Closed
rtablada opened this issue Dec 13, 2014 · 1 comment
Closed

[Proposal] Postgres - Create Superuser For vagrant role #422

rtablada opened this issue Dec 13, 2014 · 1 comment

Comments

@rtablada
Copy link
Contributor

Right now, Vaprobash creates a root role for working with postgres.
However, this root user doesn't have privileges to create new DBs, roles, etc.

For startup development, this doesn't cause an issue.
However issues begin to show up when working with pg_restore.

Since postgres is the only user with superuser status, all restores have to be made with the postgres user.
This means that restored dbs will be owned by postgres.
The issue arises when trying to change ownership of relations (tables, databases, etc) from postgres, which is not allowed and will throw an error cannot reassign ownership of objects owned by role postgres because they are required by the database system.

My suggestion is that we create a vagrant role by default with superuser privaleges.
This means that when working with postgres in vagrant boxes, we will no longer have to do things like: sudo -u postgres createdb ... and sudo -u postgres pg_restore ....
And as an added benefit, to reassign ownership of databases, you can easily run pgsql db_name -c "REASSIGN OWNED BY vagrant to db_user_name"


A similar approach is used by forge servers and the forge role.

@fideloper
Copy link
Owner

Sounds perfect! Let's move any more discussion to #423

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants