Skip to content

Conversation

marceloneppel
Copy link
Member

@marceloneppel marceloneppel commented Sep 24, 2025

Issue

There is no documentation for the new predefined roles.

Solution

Document those roles, as it was done for the PG 16 VM charm (canonical/postgresql-operator#1054).

Update the users' documentation to reflect the new roles structure (removing the admin extra user role, which exists only for the PG 14 charm).

Also, fix the toctree from docs/explanation/index.md based on the approach suggested on https://github.com/canonical/postgresql-operator/pull/1084/files/3359f0ab7338cee122a4e3215ec4f1ac350a9b4a#r2259899679 and fix some Juju anchors.

Checklist

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

@marceloneppel marceloneppel added the not bug or enhancement PR is not 'bug' or 'enhancement'. For release notes label Sep 24, 2025
@marceloneppel marceloneppel marked this pull request as ready for review September 24, 2025 18:42
Copy link
Contributor

@taurus-forever taurus-forever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, can you please add description about the proper way of escalating the privileges?

test123=> SELECT * FROM pg_roles WHERE rolname LIKE 'charmed_test_%';
rolname | rolsuper | rolinherit | rolcreaterole | rolcreatedb | rolcanlogin | rolreplication | rolconnlimit | rolpassword | rolvaliduntil | rolbypassrls | rolconfig | oid
--------------------+----------+------------+---------------+-------------+-------------+----------------+--------------+-------------+---------------+--------------+-----------+-------
charmed_test_owner | f | t | f | f | f | f | -1 | ******** | | f | | 16396
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when I request database databases, re: charmed_databases_owner in line 61?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The charm will throw an error. I'm currently working on fixing that. Thanks for catching this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed on canonical/postgresql-single-kernel-library#18 (there are two follow-up PRs in the operators repositories).

Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Copy link
Contributor

@a-velasco a-velasco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @marceloneppel!

@marceloneppel
Copy link
Member Author

LGTM, can you please add description about the proper way of escalating the privileges?

Apologies, Alex! I missed your request about escalation. I updated the PR on e2a92e4 with that.

Could you review it again, @taurus-forever and @a-velasco? Thanks!

Regular relation users can temporarily escalate their privileges to other predefined roles using PostgreSQL's role-switching features. There are two approaches:

- SET ROLE / RESET ROLE (standard, built-in)
- The `set_user`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe The set_user/reset_user` to mimic line above.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated on 02e634a.

Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

not bug or enhancement PR is not 'bug' or 'enhancement'. For release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants