0

I have created a group (role) called "employees" and I've created some users that are its member and that inherit its rights. I have a database owned by the group "employees".

The goal: To setup things in a way that allows all of the users to work with all of the objects in the database.

The problem: I can't expect the users to set the owner to "employees" when they create a new object, because they use various limited interfaces to work with the database. When they create a schema or a table, it gets created with the user as its owner, which means that the other users don't have rights on that schema/table.

I'm using PostgreSQL 11.2.

Marcello Miorelli
17.3k53 gold badges182 silver badges324 bronze badges
asked Jun 23, 2019 at 21:45
2
  • Maybe it is enough to work with default permissions on a schema? Commented Jun 23, 2019 at 23:54
  • You cannot do it if you limit yourself to tools that do not allow the users to perform a simple statement like SET ROLE employees. Commented Jun 24, 2019 at 6:45

1 Answer 1

0

Assuming you already have

GRANT employees TO john;

Just do

ALTER USER john SET ROLE TO employees;

Now when john connects he will automatically have role employees and when he creates an object it will be owned by employees;

answered Jun 30, 2019 at 9:02

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.