Granting rw permissions on cloudsql postgres
Asked Answered
W

1

6

I have these users:

postgres | Create role, Create DB | {cloudsqlsuperuser}
proxyuser | Create role, Create DB | {cloudsqlsuperuser}
qa|Create role, Create DB | {cloudsqlsuperuser}

And these tables:

                List of relations
 Schema |        Name        | Type  |   Owner
--------+--------------------+-------+-----------
 public | member_preferences | table | proxyuser
 public | message_queue      | table | proxyuser
 public | pubsub_queue       | table | proxyuser

I am currently logged in as a postgres user and would like to give qa user permissions to read and write from any of those tables and any tables created in that schema in the future.

I was trying to follow this.

However, when I run GRANT SELECT ON ALL TABLES IN SCHEMA public TO qa; It responds with: ERROR: permission denied for relation message_queue

How do I troubleshoot this further? What am I missing?

PostgreSQL 9.6.1 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4, 64-bit is the version the instance displays

UPDATE:

I had to login as the proxyuser that was generating the tables in the first place to be able to give the permissions to the other user to read and write. This is really uncomfortable because all the users have the cloudsqlsuperuser role applied to them. As such, I expect the grant on the table to work from any of these users to any of them.

Whitewash answered 10/11, 2017 at 2:9 Comment(0)
R
1

I encountered an issue which may be similar to yours which is now resolved by the method below:

  • Login as the first user you made when setting up the instance (not postgres)
  • Use this user to grant privileges to subsequent users

Google appears to grant the first user all privileges but not subsequent users.. maybe?!

Rennie answered 17/11, 2017 at 19:25 Comment(1)
Yes, this is what I did eventually. Unfortunately, doesn't resolve my mystery.Whitewash

© 2022 - 2024 — McMap. All rights reserved.