Skip to content

[Chore]: refactor object-privilege SQL into a shared GRANT/REVOKE primitive #10828

Description

@gbartolini

The Database CRD reconciler already manages USAGE grants on FOREIGN DATA WRAPPER and FOREIGN SERVER objects, via applyUsagePermissions in internal/management/controller/database_controller_sql.go. That helper hardcodes the USAGE privilege keyword and quotes every grantee as an identifier.

Two upcoming features need to issue GRANT/REVOKE for other privileges on other object types:

Without a refactor, each of these would duplicate the grant/revoke loop and re-implement the same edge cases. In particular, both need correct handling of the PUBLIC pseudo-role, which applyUsagePermissions does not currently provide, and REVOKE CONNECT ... FROM PUBLIC is the single most common database-hardening operation users want.

This issue covers only the preparatory, behaviour-preserving refactor. The two features build on top of it.

Activity

  1. added theissue type on Jun 3, 2026
  2. added
    chore
    on Jun 3, 2026
  3. added this to the 1.30.0 milestone on Jun 3, 2026
  4. moved this from Ready to In Development in CloudNativePG operator developmenton Jun 3, 2026
  5. gbartolini commented on Jun 3, 2026

    @gbartolini
    ContributorAuthor

    /test

  6. added 2 commits that reference this issue on Jun 5, 2026
    6922336
    28eb808
  7. added 2 commits that reference this issue on Jun 5, 2026
    a266845
    8469ba5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    chore

    Type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions