You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 thepostgres
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 ...
andsudo -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.
The text was updated successfully, but these errors were encountered: