Supposing, I have two users in Postgres 9.6 named user1
and user2
. I want to make permissions to user2
on any new table created by user1
without extra explicit grant commands for the created table. In other words, I want to make the following commands work correctly:
- Giving permissions to
user2
(I don't know what should be here!) CREATE TABLE t1 (id int)
(underuser1
)INSERT INTO t1 VALUES (5)
(underuser2
)
Please, notice, I am not supposed to make any permissions between step 2 and 3.
On step 3 I always have the error:
permission denied for relation t1
I have tried:
GRANT ALL PRIVILEGES ON DATABASE test TO user2;
and
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO user2;
without any success.
I also tried:
GRANT user1 TO user2
and it helped. But I can't consider it as the solution because user1
may have too high permissions (for example, it can be postgres
) that I don't want to share with user2
.