Skip to content

Set database owner to fix PG 15+ schema permissions - #409

Merged
evgeni merged 1 commit into
theforeman:masterfrom
zjhuntin:fix/pg16-db-owner-permission
Jul 15, 2026
Merged

Set database owner to fix PG 15+ schema permissions#409
evgeni merged 1 commit into
theforeman:masterfrom
zjhuntin:fix/pg16-db-owner-permission

Conversation

@zjhuntin

Copy link
Copy Markdown
Contributor

Summary

  • Add owner parameter to postgresql::server::db resource so the pulpcore database is owned by the pulp user instead of postgres
  • PostgreSQL 15+ revokes CREATE on the public schema by default — only the database owner retains it
  • Without this fix, pulpcore-manager migrate fails with permission denied for schema public when running against PG 15+

Root Cause

The public schema in PG 15+ is owned by pg_database_owner, a special role that maps to the database owner. When the database is owned by postgres (the default when owner is not set), the pulp user has no CREATE privilege on the public schema and cannot run Django migrations.

Note: puppet-foreman already sets owner correctly — this aligns puppet-pulpcore with that pattern.

Test plan

  • Verified fix on a RHEL 9.8 instance with PG 16 — installer completed successfully after patching this file
  • Existing rspec tests pass (they check resource existence, not parameters)

🤖 Generated with Claude Code

PostgreSQL 15+ revokes CREATE on the public schema from all users
except the database owner. Without setting owner, the database is
owned by postgres and the pulp user cannot create tables, causing
pulpcore-manager migrate to fail with "permission denied for schema
public".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@evgeni

evgeni commented Jul 15, 2026

Copy link
Copy Markdown
Member

Where did you end up with Pulpcore running against PostgreSQL 16, while deployed by Puppet?

The fix is correct, I am mostly curious why it was needed.

@evgeni evgeni added the Bug Something isn't working label Jul 15, 2026
@evgeni
evgeni merged commit 69143ce into theforeman:master Jul 15, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants