11

How do I create a user with superuser role in Postgres serwer with google cloud console?

When I create databases in google cloud, the default user is a non-superuser. From this role it is not possible to upgrade.

Troels
  • 342
  • 3
  • 16

2 Answers2

10

no way:

https://cloud.google.com/sql/docs/postgres/users

The postgres user is part of the cloudsqlsuperuser role, and has the following attributes (privileges): CREATEROLE, CREATEDB, and LOGIN. It does not have the SUPERUSER or REPLICATION attributes.

Vao Tsun
  • 47,234
  • 13
  • 100
  • 132
0

Here's my own script:

GRANT cloudsqlimportexport, cloudsqlsuperuser, pg_read_all_data, pg_write_all_data, postgres TO myawsumuser WITH ADMIN OPTION;

GRANT ALL PRIVILEGES ON DATABASE mytestdb1 TO myawsumuser WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON DATABASE postgres TO myawsumuser WITH GRANT OPTION;

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO myawsumuser with grant option;
GRANT USAGE ON SCHEMA public TO myawsumuser with grant option;

GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO myawsumuser with admin option;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO myawsumuser with grant option;

ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO myawsumuser with grant option;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON SEQUENCES TO myawsumuser with grant option;

Good links: https://cloud.google.com/sql/docs/postgres/users

How to grant all privileges on views to arbitrary user

JDOaktown
  • 4,262
  • 7
  • 37
  • 52