NeonN
Neon11mo ago
3 replies
spontaneous-moccasin

How to GRANT superuser to Neon-created db owner role?

When creating database datamart_db, Neon automatically created role datamart_db_owner. We have another role with more restricted access (used by external replicator) that creates tables within this database. Since datamart_db_owner does not own those tables it cannot GRANT privileges on them (even just SELECT). It seems like datamart_db_owner, since we use it as our 'admin' role, should have Postgres SUPERUSER role (ie. the Postgres role, not neon_superuser) but trying
ALTER ROLE datamart_pg_owner SUPERUSER
fails with "permission denied to alter role" from within the Neon UI. I see your doc on making a new role SUPERUSER (https://neon.tech/postgresql/postgresql-administration/create-superuser-postgresql) but it seems like if SQL Editor is run as datamart_db_owner, that's the one that should be SUPERUSER. Overall, some guidance on how to manage roles within the Neon environment, with its special role configurations, would be helpful -- it seems the docs are mostly about generic Postgres role management.
Neon
In this tutorial, you will learn about PostgreSQL superusers and how to create them using the CREATE ROLE statement.
How to Create Superuser in PostgreSQL
Was this page helpful?