Skip to content

Fix CREATE EXTENSION on PG16+ without a superuser (RDS/Aurora) (#14)#18

Open
jnasbyupgrade wants to merge 3 commits into
Postgres-Extensions:masterfrom
jnasbyupgrade:fix/issue-14-clean
Open

Fix CREATE EXTENSION on PG16+ without a superuser (RDS/Aurora) (#14)#18
jnasbyupgrade wants to merge 3 commits into
Postgres-Extensions:masterfrom
jnasbyupgrade:fix/issue-14-clean

Conversation

@jnasbyupgrade

@jnasbyupgrade jnasbyupgrade commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

CREATE EXTENSION test_factory fails on PostgreSQL 16+ when installed by a non-superuser role:

ERROR:  must be able to SET ROLE "test_factory__owner"

As of PG16, CREATE ROLE no longer grants the creating role a SET-enabled membership in the new role, so the install's SET ROLE test_factory__owner is rejected. A superuser bypasses the check, so this only surfaces for non-superuser installs (e.g. RDS/Aurora).

Fix: after creating the role, grant it back to the installing role WITH SET, gated on PG16+ (pre-16 GRANT ... TO already permits SET ROLE). The grant is unconditional so it also covers the case where the role already existed.

The failure can't be reproduced under pg_regress, which runs as a superuser, so the added test instead asserts the SET-enabled membership the fix establishes.

Fixes #14

🤖 Generated with Claude Code

Adds the Claude Code GitHub Actions workflows: `claude.yml` (@claude
mentions) and `claude-code-review.yml` (auto-review on PRs from the
jnasbyupgrade fork via pull_request_target, gated to that fork).
Requires the `CLAUDE_CODE_OAUTH_TOKEN` secret on this repo and the
Claude GitHub App granted access. Part of enabling Claude Code review
across the postgresql-extensions repos.

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5b9df93a-c4e9-4e12-9cd7-e30a47e4b9d1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

jnasbyupgrade and others added 2 commits July 14, 2026 17:25
…ruser

As of PG16, CREATE ROLE no longer grants the creating role a SET-enabled
membership in the new role, so the install's `SET ROLE test_factory__owner`
fails unless the current role is a superuser (which bypasses the check). This
surfaces only on non-superuser installs (e.g. RDS/Aurora).

Grant the role back to the installing role WITH SET, gated on PG16+ (pre-16
GRANT already permits SET ROLE). Unconditional, so it also covers a
pre-existing role where CREATE ROLE was a no-op.

Fixes Postgres-Extensions#14

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Postgres-Extensions#14)

The failure can't be reproduced under pg_regress, which runs as a superuser
that bypasses the SET ROLE check. Instead assert the state the fix establishes:
after install the installing role holds a SET-enabled membership in
test_factory__owner (PG16+; skipped with identical output pre-16).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CREATE EXTENSION fails on PG16+ without a superuser (RDS/Aurora): must be able to SET ROLE "test_factory__owner"

1 participant