Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Granting rw permissions on cloudsql postgres

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.

like image 621
user3081519 Avatar asked Nov 08 '22 14:11

user3081519


1 Answers

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?!

like image 98
eamon1234 Avatar answered Nov 14 '22 22:11

eamon1234